开发者

create thumbnail with Symfony or PHP

开发者 https://www.devze.com 2023-03-30 16:39 出处:网络
i use sfThumbnailPlugin for Symfony 1.4. I have problem... For example: i set: $thumbnail = new sfThumbnail(80, 100);

i use sfThumbnailPlugin for Symfony 1.4. I have problem... For example:

i set:

 $thumbnail = new sfThumbnail(80, 100);

and if i upload image 700px/400px then this plugi开发者_运维问答n make image 80px/40px instead of 80/100. If image is 400/700 this is ok. I know that be blurred.

How can i fix? Or how can i make in clear PHP?


Please take a look at the docu or the constructor of the plugin :

/**
 * Thumbnail constructor
 *
 * @param int (optional) max width of thumbnail
 * @param int (optional) max height of thumbnail
 * @param boolean (optional) if true image scales
 * @param boolean (optional) if true inflate small images
 * @param string (optional) adapter class name
 * @param array (optional) adapter options
 */
public function __construct($maxWidth = null,
                            $maxHeight = null,
                            $scale = true,
                            $inflate = true,
                            $quality = 75,
                            $adapterClass = null,
                            $adapterOptions = array()
                           )

You need to modify your parameters like this e.g.

// so height will be calculated
$thumbnail = new sfThumbnail(80, null, true);
0

精彩评论

暂无评论...
验证码 换一张
取 消