Zen Cart Logo
Forums / Bug Reports / [DONE 1.3.5] Fractional Image Sizes - syntax error

[DONE 1.3.5] Fractional Image Sizes - syntax error

Locked

Views: 1,579

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
22 Jul 2006, 1:53 PM
#1
brian_the_brain avatar

brian_the_brain

New Zenner

Join Date:
Jul 2006
Posts:
16
Plugin Contributions:
0

[DONE 1.3.5] Fractional Image Sizes - syntax error

Resizing images can give a syntax error because of fractional pixel dimensions. For example I have a graphic on the front page (http://prints.brianthebrain.com) that has the dimensions

width="200" height="90.909090909091" and on the category page

width="300" height="136.36363636364"

I have edited the file includes/functions/html_output.php around lines 219 and 221.

219 $width = $image_size[0] * $ratio;
220 } else {
221 $height = $image_size[1] * $ratio;
222 }

to

219 $width = round($image_size[0] * $ratio);
220 } else {
221 $height = round($image_size[1] * $ratio);
222 }

This has corrected the error on my local copy of the cart.

I would rather do the correction here rather than do slight tweaks on the catalog image. Or maybe there is a better fix.

zen-cart 1.3.02

22 Jul 2006, 10:14 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: [DONE 1.3.5] Fractional Image Sizes - syntax error

What exactly is telling you this is a "syntax" error?

(Trying to classify this as a bug or not.)

23 Jul 2006, 1:25 AM
#3
brian_the_brain avatar

brian_the_brain

New Zenner

Join Date:
Jul 2006
Posts:
16
Plugin Contributions:
0

Re: [DONE 1.3.5] Fractional Image Sizes - syntax error

DrByte:

What exactly is telling you this is a "syntax" error?

(Trying to classify this as a bug or not.)

I use BBEdit writing/testing/debugging. When I check the validity of the html code for the pages, I get this error

Line 182: Value of attribute “height” for element “<img>” must be a number or percent (for example “50” or “50%”).

the expection is for 90 or 91 vs. the 90.909090909091 actually generated.

I hope this make sense.

23 Jul 2006, 2:16 AM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: [DONE 1.3.5] Fractional Image Sizes - syntax error

Thanks - I wasn't certain which code validation system you were using. W3C doesn't seem to care from a validation perspective, however many htmltidy tools do.

Your suggestion works fine. Some have suggested using ceil() instead of round().... I guess both have merits.