Landscape or portrait images

See all posts Reply

Landscape or portrait images new!
by marko, 17 years, 1 month ago
Hi there,
When I want to resize an image, I want the script to see if it has to deal with a landscape image or a portrait one. When it's a landscape image, it has to become 600 px wide (ratio_y). When it's a portait, I want it to be 500 px high (ratio_x).
How do I do that?Reply
Re: Landscape or portrait images new!
by colin, 17 years, 1 month ago
You can do this with a little bit of coding.

Instantiate the class first, and then if $foo->uploaded == true, you can read the following variables:
image_src_x
image_src_y
image_src_bits, 
image_src_pixels
image_src_type
Then, you can call $foo->process() with different parameters, depending on the variables above.

Note that this will not work if open_basedir restrictions are in place.Reply
Re: Landscape or portrait images new!
by marko, 17 years, 1 month ago
Hi Colin, thnx for te reply.
I'm not much of a coder but I do understand what you mean, altough it doesn't work here...

When I read $foo->image_src_x after "if $foo->uploaded == true" I get a value of "0". When I read it after $foo->process(), it returns the correct x-value, but than I can't change the variables to get the difference between landscape and portrait...

Perhaps this has something to do with the open_basedir restrictions altough I don't know what you mean by that.Reply
Re: Landscape or portrait images new!
by colin, 17 years, 1 month ago
First, you need to use version 0.25 RC1, that you can find here, I forgot to mention that.

Then, if it still doesn't work, can you provide us with a link to your phpinfo()?Reply
Re: Landscape or portrait images new!
by marko, 17 years, 1 month ago
Now it works!!
Thnx mate.Reply