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.
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.
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/
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:
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.
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
Chris
Re: [chris] Image Upload: Warning: Division by zero
By Chris - April 20, 2010
Hi aquaman,
Unfortunately, my "workaround" was crashing Apache when I uploaded certain files. Crashing webservers is generally considered bad form, so I'm abandoning that approach.
The problem comes down to certain Canon cameras and PHP, as bizarre as that may seem.
The next beta of CMS Builder will no longer suffer a "division by zero" error when a corrupt JPEG is uploaded, but such photos will not be thumbnailed and their heights and widths will not be known.
Sorry we couldn't be of more help. Please let us know if you have any questions.
Unfortunately, my "workaround" was crashing Apache when I uploaded certain files. Crashing webservers is generally considered bad form, so I'm abandoning that approach.
The problem comes down to certain Canon cameras and PHP, as bizarre as that may seem.
The next beta of CMS Builder will no longer suffer a "division by zero" error when a corrupt JPEG is uploaded, but such photos will not be thumbnailed and their heights and widths will not be known.
Sorry we couldn't be of more help. Please let us know if you have any questions.
All the best,
Chris
Chris