Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

NEED Keep Image Proportions contribution for V1.49


byunkook

Recommended Posts

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.

Link to comment
Share on other sites

  • 4 weeks later...

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...