byunkook Posted March 1, 2003 Posted March 1, 2003 The latest Keep Image Proportions contribution is for html_output v. 1.45 I was tring to apply the code. I found out that my html_output.php is v. 1.49 and I couldn't find the same string that the manual refers to. the contribution that I'm refering to is http://www.oscommerce.com/community/contri...ions,746/page,6 I'm kind of stuck here. Please can someone help me out? Thank you. Quote
gdfwilliams Posted March 1, 2003 Posted March 1, 2003 the easiesy way to keep image proportions is simply to remove the height definitions in admin>configuration>images. Quote
Guest Posted March 25, 2003 Posted March 25, 2003 When there's no image on a category I get a division to zero error in html_output.php. I did the following: This is the code which is added by the contribution: // BEGIN Code inserted to maintain proportions of images. if (IMAGE_CONSTRAIN_PROPORTIONS == 'true') { $image_size = @getimagesize($src); $ratio = $width / $image_size[0]; if ($image_size[1]*$ratio > $height) { $ratio = $height / $image_size[1]; $width = $image_size[0] * $ratio; } else { $height = $image_size[1] * $ratio; } $image .= ' width="' . tep_parse_input_field_data($width, array('"' => '"')) . '" height="' . tep_parse_input_field_data($height, array('"' => '"')) . '"'; } } // END Code inserted to maintain proportions of images. I added the following to this: // BEGIN Code inserted to maintain proportions of images. if (IMAGE_CONSTRAIN_PROPORTIONS == 'true') { $image_size = @getimagesize($src); // the following line is added if ($image_size[0] <> 0) { // $ratio = $width / $image_size[0]; if ($image_size[1]*$ratio > $height) { $ratio = $height / $image_size[1]; $width = $image_size[0] * $ratio; } else { $height = $image_size[1] * $ratio; } // end this one offcourse } // $image .= ' width="' . tep_parse_input_field_data($width, array('"' => '"')) . '" height="' . tep_parse_input_field_data($height, array('"' => '"')) . '"'; } } // END Code inserted to maintain proportions of images. Now the error is gone... Now when there's no image available the size = 0 and the code will not be generated. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.