Part of the EllisLab Network
   
 
Maintain Aspect Ratio when resizing…
Posted: 18 December 2006 02:46 PM   [ Ignore ]  
Grad Student
Avatar
Rank
Total Posts:  78
Joined  12-17-2006

Dear members,

When using the image_lib with the following config

$config['source_image'] = '/path/to/image/mypic.jpg';
$config['maintain_ratio'] = TRUE;
$config['width'] = 75;


and using a picture thats e.g. 400px x 200px (w x h) I get a real strange result
Instead of resizing the picture to a width of 75px and height of 38px (or something like that) as one would expect it just creates a picture being
75px wide and 200px high!
And I dont think that this is wanted behaviour.

Its obviously caused by the following lines within libraries/Image_lib.php

264:          * Should we maintain image proportions?
265:          *
266:          * When creating thumbs or copies, the target width/height
267
:          * might not be in correct proportion with the source
268
:          * image's width/height.  We'll recalculate it here.
269:          *
270:          */
271:         if ($this->maintain_ratio === TRUE && ($this->width != '' AND $this->height != ''))
272:         {
273
:             $this->image_reproportion();
274:         }
275
:

Maybe it should be like

271:         if ($this->maintain_ratio === TRUE && ($this->width != '' OR $this->height != ''))

I hope this can be fixed because I doesnt make sense to set an arbitrary height of ...lets say 300px too in order to prevent the picture from being malformed!

Thank you very much in advance!

greets Rico

 Signature 

moormanweb.info

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 719, on June 06, 2008 10:16 AM
Total Registered Members: 66431 Total Logged-in Users: 25
Total Topics: 84797 Total Anonymous Users: 2
Total Replies: 455084 Total Guests: 229
Total Posts: 539881    
Members ( View Memberlist )
Newest Members:  GlennJDylan1978X_franbaguasllogocsaturkeyPeter BryanttherendStudioGeorgiaJZeer