PHP divide by zero error
Permalink
Hey Guys,
So I've recently had a website break, but I'm at a total loss as to why. In FTP I'm getting this error:
"[13-Feb-2014 20:31:04] PHP Warning: Division by zero in /home/ivesroad/public_html/packages/simpleblog/blocks/sb_add_blog/view.php on line 20"
The offending code is this:
"if (!function_exists('image_Resize')) {
function image_Resize($width, $height, $target) { // this is so the images display at 135X150
$new_height = round($height * $percentage);
if ($width > $height) {
$percentage = ($target / $width);
} else {
$percentage = ($target / $height); (THIS IS LINE 20)
}
if ($width < ($target * .9) || $width > $height){
$width = ($target * .9);
} else {$width = round($width * $percentage);}
if (
$new_height < $target){
$height = $target;
} else {$height = $new_height;}
return "width=\"$width\" height=\"$height\"";
}
}"
Inspecting the website in a browser console yields this error:
"event.returnValue is deprecated. Please use the standard event.preventDefault() instead."
I believe this is just a warning for deprecated code, and shouldn't be breaking anything. Also, there is no HTML or CSS being called/displayed at all.
I've never run into anything like this before, so I'm at a total loss as to what it could be. Any help at all would be greatly appreciated.
Thanks in advance.
So I've recently had a website break, but I'm at a total loss as to why. In FTP I'm getting this error:
"[13-Feb-2014 20:31:04] PHP Warning: Division by zero in /home/ivesroad/public_html/packages/simpleblog/blocks/sb_add_blog/view.php on line 20"
The offending code is this:
"if (!function_exists('image_Resize')) {
function image_Resize($width, $height, $target) { // this is so the images display at 135X150
$new_height = round($height * $percentage);
if ($width > $height) {
$percentage = ($target / $width);
} else {
$percentage = ($target / $height); (THIS IS LINE 20)
}
if ($width < ($target * .9) || $width > $height){
$width = ($target * .9);
} else {$width = round($width * $percentage);}
if (
$new_height < $target){
$height = $target;
} else {$height = $new_height;}
return "width=\"$width\" height=\"$height\"";
}
}"
Inspecting the website in a browser console yields this error:
"event.returnValue is deprecated. Please use the standard event.preventDefault() instead."
I believe this is just a warning for deprecated code, and shouldn't be breaking anything. Also, there is no HTML or CSS being called/displayed at all.
I've never run into anything like this before, so I'm at a total loss as to what it could be. Any help at all would be greatly appreciated.
Thanks in advance.
If you have a look at the image in the file manager, you will see whether that is correct.
Maybe there is a glitch in the image file.
Maybe it has been deleted since the post was made.