Jump to content

Recommended Posts

Posted
I have an image 500x300 

I need to apply the resizing to 150x150 without cutting edge. 

Thus in any case, I need to have the image canvas size 150x150 

When you use $ image->size (150, 150), we obtain the desired result (cropping). 

When using $ image->size (150, 150, array ('cropping' => false)) our image circumcised according to the greatest height, canvas change proportionally. / / 150x90. 

Need an image 150x90 position in the center of the canvas 150x150. 

You can do this using the API?

post-2003-0-65413500-1392706786_thumb.pn

Posted

$ratioX = 150 / $image->width;

$ratioY = 150 / $image->height;

// the least expensive, is taken for size caculation

$width = min($ratioX, $ratioY) * $image->width;

$height = min($ratioX, $ratioY) * $image->height;

$image->size($width,$height);

Posted

post-2003-0-65413500-1392706786_thumb.pn

You did draw: resize the image till one of the edges reach 150px, can be width or can be height or both if the original is square.

if you don't want this, do you want to mesh up with the aspect ratio ? 

  • Like 1
Posted

I'm not sure if I understand right, but may be you can use PageImageManipulator for that?

$img = $images->first();
$url = $img->pimLoad('myprefix')->canvas(150, 150, array(255,255,255,1), 'c', 0)->pimSave()->url;

Posted

First I don't understand why you would send "unnecessary" pixels over the internet. I would say, don't send them and make the space you need with the HTML container element.

Second, why do want to spoil server CPU for this.

Third, if you want to make it your self difficult. here is the documentation.

  • Like 1
Posted

  GD spoils color in JPG

Oh, really? Please, can you show me a example? (original | GD | and maybe one with imageMagick)

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...