From e42176e664586f1c13c36e18fead54a6776cb387 Mon Sep 17 00:00:00 2001
From: Gerry Weissbach <gerry.w@gammaproduction.de>
Date: Sun, 27 Jul 2008 20:02:06 +0200
Subject: [PATCH] Avoid div by zero in get_cropped() FS#1453

darcs-hash:20080727180206-0d72e-28f6206ebe4f6c36f835c50f46d9cbe220ab6177.gz
---
 lib/exe/fetch.php | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/exe/fetch.php b/lib/exe/fetch.php
index c39e21173..9bfb5d1d4 100644
--- a/lib/exe/fetch.php
+++ b/lib/exe/fetch.php
@@ -245,7 +245,8 @@ function get_cropped($file, $ext, $w, $h=0){
   global $conf;
 
   if(!$h) $h = $w;
-  $info = getimagesize($file); //get original size
+  $info = @getimagesize($file); //get original size
+  if($info == false) return $file; // that's no image - it's a spaceship!
 
   // calculate crop size
   $fr = $info[0]/$info[1];
-- 
GitLab