Welcome Guest, Not a member yet? Register   Sign In
URGENT: Image upload & resize issues
#3

[eluser]err403_love[/eluser]
First, try changing:
Code:
$config['width'] = 130 * $crop_ratio;
$config['height'] = 150 * $crop_ratio;
$config['x_axis'] = ($img_width - $config['width'])/2;
$config['y_axis'] = ($img_height - $config['height'])/2;

to:
Code:
$config['width'] = floor(130 * $crop_ratio);
$config['height'] = floor(150 * $crop_ratio);
$config['x_axis'] = floor(($img_width - $config['width'])/2);
$config['y_axis'] = floor(($img_height - $config['height'])/2);

Because just testing out print_r for a "fake" $config array that I put into its own test file gave me:
Code:
Array ( [new_image] => fake image path [width] => 937 [height] => 1081.1538461538 [x_axis] => 0 [y_axis] => -8.5769230769231 [maintain_ratio] => )

It SEEMS that Image_lib.php already does this though (rounds), for the width and height. But you should do this at least to troubleshoot and see if it gets rid of your problem.

I can't seem to find info on whether or not the X and Y axes need to be an integer, and I can't find anywhere where the Image_lib actually rounds it, so you should definitely try this out, at least to troubleshoot.

Also, if you want, try to see if you can use $config['master_dim'] for what you're trying to do. You may be able to get rid of your own ratio code if you use that instead.


Messages In This Thread
URGENT: Image upload & resize issues - by El Forum - 05-13-2008, 04:35 PM
URGENT: Image upload & resize issues - by El Forum - 05-14-2008, 08:15 AM
URGENT: Image upload & resize issues - by El Forum - 05-14-2008, 11:35 AM
URGENT: Image upload & resize issues - by El Forum - 05-14-2008, 11:49 AM
URGENT: Image upload & resize issues - by El Forum - 05-14-2008, 12:37 PM
URGENT: Image upload & resize issues - by El Forum - 05-14-2008, 12:51 PM
URGENT: Image upload & resize issues - by El Forum - 05-14-2008, 12:55 PM



Theme © iAndrew 2016 - Forum software by © MyBB