Image Upload: Warning: Division by zero

4 posts by 3 authors in: Forums > CMS Builder
Last Post: April 20, 2010   (RSS)

Hi, we just started getting this error for a few images:

Warning: Division by zero in /home/luxurychartergroup/luxurychartergroup.com/cms/lib/menus/default/common.php on line 142

Could it be corrupt images as its only a few of them that have issues. I have attached two of the suspect images.

FYI, I did find a reference to this error in an earlier post here: http://www.interactivetools.com/forum/gforum.cgi?post=75029;search_string=Warning%3A%20Division%20by%20zero;#75029

We did upgrade to version 2.03 recently as well.

Re: [aquaman] Image Upload: Warning: Division by zero

By Jason - April 16, 2010

Hi,

Yeah, that's an interesting one. It definitely seems to be an issue with the images, as I wasn't able to upload them either. However, I found a work around:

-open the image in an image editor
-select the entire image and copy it.
-open a new image file
-paste in the image and save it under a new name.

You should be able to upload that image now. Let me know if that works for you.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Image Upload: Warning: Division by zero

By Chris - April 17, 2010

Hi aquaman,

I've done some further research on this.

It seems that those two JPEGs are actually slightly "corrupt", but most software is wise enough to just ignore the minor problem. Unfortunately, GD (which is the library that PHP uses for images) is really picky about this minor problem. I was able to get PHP to cough up this about cosmos-5.jpg:

Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: gd-jpeg, libjpeg: recoverable error: Corrupt JPEG data: 2781 extraneous bytes before marker 0xed

Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: 'C:\Users\Chris\Desktop\cosmos-5.jpg' is not a valid JPEG file


And yet, they work fine in web browsers and probably everywhere else (except possibly GIMP, from what I've read.) *sigh*

I think I may have found a work-around, but it's going to take some further research.

In the meantime, please follow Jason's advice. If you're using Windows and don't have a photo editor, I recommend the free "Paint .NET" which does a pretty good job of providing standard photo-editing features.

P.S. How were those two JPEGs created? If you have any control over the process, you may consider upgrading the software that was used in their creation or trying out different software.

I hope this helps! Please let us know if you have any questions.
All the best,
Chris