CodeIgniter Forums

Full Version: image manipulation
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2

El Forum

[eluser]ikim[/eluser]
Hello,

Im making an application where you upload a picture and then the app creates a thumbnail.

However, I want the thumbnail to come out as 85px by 85px.

The resize currently shrinks to longest side to 85px but then Im left with something like 85 by 100.

I know I must resize and then maybe crop the image but what is the best way of doing this?

Thanks

El Forum

[eluser]thachp[/eluser]
Have you try setting maintain_ratio preference to false?
Code:
$config['maintain_ratio'] = FALSE;

El Forum

[eluser]ikim[/eluser]
yeah but that distorts the image.

I would like to have it resize then cropped from the middle. But Ive been trying everything and cant seem to get it.

There are some posts about it but none of the codes does the job.

Anybody else have any suggestions?

El Forum

[eluser]Nanodeath[/eluser]
I'm confused. The resize shrinks the longest size to 85 pixels, and you end up with a 85x100 image? How is that physically possible?

El Forum

[eluser]ikim[/eluser]
That wasnt a true example. I was just trying to make a point that if a picture uploaded is a rectangle, it will remain a rectangle and not a 85px by 85px square.

If I dont use the mantain ratio, the image is then distorted and I dont want that. I just need to end up with a thumbnail that is a square and keeps the ratio.

My thoughts were to resize and then crop into a square but I cant seem to do that

El Forum

[eluser]marcoss[/eluser]
[quote author="ikim" date="1182902586"]My thoughts were to resize and then crop into a square but I cant seem to do that[/quote]

That's what you should do, how are you trying to acomplish that?

El Forum

[eluser]Crimp[/eluser]
The manual is slightly wrong on this. You need the width and height set for your crop() configs. That may do it for you. Also, if you take the width and height of your upload data array, you can figure out out the rest with / and * and proportions.

El Forum

[eluser]Lonely Angel[/eluser]
k

El Forum

[eluser]Lonely Angel[/eluser]
I want the thumbnail without to create a new image ... just to show this picture in web-site, but in small dimension (for more speed to loading .... )

Anybody can to help me ?

El Forum

[eluser]Lonely Angel[/eluser]
Can someone to help me?
Pages: 1 2