View Single Post
  #2 (permalink)  
Old 10-04-06, 12:49 AM
mab's Avatar
mab mab is offline
Community VIP
 
Join Date: Oct 2005
Location: Denver, Co. USA
Posts: 2,674
Thanks: 0
Thanked 0 Times in 0 Posts
Most likely all the errors are being caused by one initial problem.

Examining lines 311 and 315, looking for what would cause the error message given for those lines (Division by zero), we can see that $thumb_x has a zero value.

This is the second parameter in the function -
PHP Code:

function generateThumb($sourceFilename$thumb_x$square=FALSE$border=FALSE) { 

There is a call to this function at line #425 -
PHP Code:

generateThumb($pic$thumbWidth$isSquare$isBorder); 

This function is only called if the $thumbWidth is greater than zero, so it leaves the lines in the function that modify $thumb_x. The following lines can set $thumb_x to zero, if $image_width is zero -
Code:
237:     $image_info = getimagesize($sourceFilename);    
238:   
239:     $image_width = $image_info[0];    
240:   
241:     $image_height = $image_info[1];    
242:   
243:         
244:   
245:     if ($image_width<$thumb_x) $thumb_x = $image_width;
The function getimagesize(...) can return a FALSE value if the file it is testing is not an image. In this case, $image_width would be null/zero, which is causing the first two error messages. The other error messages are probably (I only traced through the errors to the point of determining the above information) because the file name in $sourceFilename is not an image. The code should test for a FALSE value returned by getimagesize(...) and take appropriate action.
__________________
Error checking, error reporting, and error recovery. If your code does not have these to get it to tell you why it is not working, what makes you think someone in a programming forum will be able to tell you why it is not working???
Reply With Quote