Welcome Guest, Not a member yet? Register   Sign In
Image resize by width only
#1

[eluser]Random dude[/eluser]
I want my users to be able to choose from 3 sizes of images:
small (200px width), med(500px width), large(800px width).

I'm trying to use the image_lib to re-size images by setting width only,
for example, if a user selects 'small', and uploads an image that's 1000px/900px,
the image will be re-sized to 200px / (height adjusted automatically). In the 1000px/900px example, that would 200px / 180px.

Right now if I set width to 200px, the height of the image stays the same. For example, 200px/900px. I'm not able to set height because users will be uploading many images of completely different sizes.

What should I do?
#2

[eluser]umefarooq[/eluser]
Hi in config keep
Code:
$config['maintain_ratio'] = TRUE;
if it is false then you will get the problem which you are facing right now check user guide also

http://ellislab.com/codeigniter/user-gui...e_lib.html
#3

[eluser]Random dude[/eluser]
Still not adjusting height automatically, here are my settings.

Code:
$config['image_library'] = 'GD2';
        $config['source_image'] = './uploads/' . $swf_folder . '/' . $swf_file_name;
        $config['create_thumb'] = FALSE;
        $config['maintain_ratio'] = TRUE;
        $config['quality'] = "85%";
        $config['new_image'] = './uploads/' . $swf_folder . '/' . $swf_small_file_name;
        $config['width'] = 250;

I think what I need is something like $config['height'] = "AUTO";
#4

[eluser]helmutbjorg[/eluser]
Are you trying to resize a SWF file?
#5

[eluser]Random dude[/eluser]
No I'm not, I just happened to name everything with swf_ because the files are coming from swfuploader.
#6

[eluser]fRkSsK[/eluser]
any idea? i have same problem.
#7

[eluser]fRkSsK[/eluser]
hmm. i think it works.

if code is:

$config['maintain_ratio'] = TRUE;
$config['width'] = 230;
$config['height'] = 175;

and if your photo w:1944 h:2592, it resize w:132 h:<b>175</b>.
or your photo w:1200 h:623, it resize w:<b>230</b> h:120.
#8

[eluser]fRkSsK[/eluser]
but i can not find <b>image_ratio_crop</b>.

verot.net has image_ratio_crop. but i want to use CI upload class. i found someting http://ellislab.com/forums/viewthread/109434/.

i think CI uploader class has not image ratio crop. has?
#9

[eluser]fRkSsK[/eluser]
solution is http://ellislab.com/forums/viewthread/115336/. but CI default preferences isn't support image ratio crop.
#10

[eluser]Udi[/eluser]
Lesson I learned lately while working with several Flash Uploaders:
echo/print something back in the end of the uploading method - Mac users may have problems if you're not doing it.




Theme © iAndrew 2016 - Forum software by © MyBB