diff --git a/main/inc/lib/image.lib.php b/main/inc/lib/image.lib.php index 27a330ab26..01ad67a4c8 100644 --- a/main/inc/lib/image.lib.php +++ b/main/inc/lib/image.lib.php @@ -20,15 +20,15 @@ class image { } function createimagefromtype($file,$handler) { - $size = getimagesize($file); + $size = @getimagesize($file); $type=$size[2]; switch ($type) { - case 2 : $imhandler = imagecreatefromjpeg($file); + case 2 : $imhandler = @imagecreatefromjpeg($file); break; - case 3 : $imhandler = imagecreatefrompng($file); + case 3 : $imhandler = @imagecreatefrompng($file); break; - case 1 : $imhandler = imagecreatefromgif($file); + case 1 : $imhandler = @imagecreatefromgif($file); break; } @@ -53,44 +53,44 @@ class image { $height = (int)($size[1]*$scale); $deltaw = (int)(($thumbw - $width)/2); $deltah = (int)(($thumbh - $height)/2); - $dst_img = ImageCreateTrueColor($thumbw, $thumbh); + $dst_img = @ImageCreateTrueColor($thumbw, $thumbh); if ( !empty($this->color)) - imagefill ( $dst_img, 0, 0, $this->color ); + @imagefill ( $dst_img, 0, 0, $this->color ); $this->bgx=$thumbw; $this->bgy=$thumbh; } elseif ($border==0) { - $scale = min($thumbw/$size[0], $thumbh/$size[1]); + $scale = ($size[0] > 0 && $size[1] >0)?min($thumbw/$size[0], $thumbh/$size[1]):0; $width = (int)($size[0]*$scale); $height = (int)($size[1]*$scale); $deltaw = 0; $deltah = 0; - $dst_img = ImageCreateTrueColor($width, $height); + $dst_img = @ImageCreateTrueColor($width, $height); $this->bgx=$width; $this->bgy=$height; } $src_img = $this->bg; - ImageCopyResampled($dst_img, $src_img, $deltaw, $deltah, 0, 0, $width, $height, ImageSX($src_img),ImageSY($src_img)); + @ImageCopyResampled($dst_img, $src_img, $deltaw, $deltah, 0, 0, $width, $height, ImageSX($src_img),ImageSY($src_img)); $this->bg=$dst_img; - imagedestroy($src_img); + @imagedestroy($src_img); } function addbackground($bgfile) { if ( !empty($bgfile) && file_exists($bgfile) ) { $this->bg = image::createimagefromtype($bgfile,'bg'); - imagealphablending( $this->bg ,TRUE ); + @imagealphablending( $this->bg ,TRUE ); } } function addlogo($file) { $this->logo = image::createimagefromtype($file,'logo'); - imagealphablending( $this->logo ,TRUE ); + @imagealphablending( $this->logo ,TRUE ); $size = getimagesize($file); $this->logox=$size[0]; $this->logoy=$size[1]; @@ -100,11 +100,11 @@ class image { function mergelogo($x,$y,$alpha=100) { if ($x<0) $x=$this->bgx-$this->logox+$x; if ($y<0) $y=$this->bgy-$this->logoy+$y; - return imagecopymerge ( $this->bg, $this->logo, $x, $y, 0, 0, $this->logox, $this->logoy, $alpha ); + return @imagecopymerge ( $this->bg, $this->logo, $x, $y, 0, 0, $this->logox, $this->logoy, $alpha ); } function makecolor($red, $green, $blue) { - $this->color = imagecolorallocate( $this->bg, $red, $green, $blue ); + $this->color = @imagecolorallocate( $this->bg, $red, $green, $blue ); } function setfont($fontfile) { @@ -116,7 +116,7 @@ class image { $this->fontfile='verdana'; $text= preg_replace('`(?fontfile, $text ); + $box=@imagettfbbox ( $size, $angle, $this->fontfile, $text ); if ($x<0) { $x=$this->bgx - max($box[2],$box[4]) + $x; } else { @@ -128,7 +128,7 @@ class image { $y=max(-$box[7],-$box[5]) + $y; } - imagettftext($this->bg, $size, $angle, $x, $y, $this->color, $this->fontfile , $text ); + @imagettftext($this->bg, $size, $angle, $x, $y, $this->color, $this->fontfile , $text ); } @@ -143,20 +143,20 @@ class image { case 'PNG' : if (!$file) header("Content-type: image/png"); if ($compress!=-1) - imagetruecolortopalette ( $this->bg, true, $compress); + @imagetruecolortopalette ( $this->bg, true, $compress); return imagepng($this->bg,$file,$compress); break; case 'GIF' : if (!$file) header("Content-type: image/gif"); if ($compress!=-1) - imagetruecolortopalette ( $this->bg, true, $compress); + @imagetruecolortopalette ( $this->bg, true, $compress); return imagegif($this->bg,$file,$compress); break; default: return 0; } - imagedestroy($this->bg); - imagedestroy($this->logo); + @imagedestroy($this->bg); + @imagedestroy($this->logo); } diff --git a/main/install/update-db-1.8.5-1.8.6.inc.php b/main/install/update-db-1.8.5-1.8.6.inc.php index 2daaf28ede..cffb172210 100644 --- a/main/install/update-db-1.8.5-1.8.6.inc.php +++ b/main/install/update-db-1.8.5-1.8.6.inc.php @@ -1,4 +1,4 @@ - 0)?round(($thumbwidth/$picture_infos[0])*$picture_infos[1]) : 0; $temp->resize($thumbwidth,$new_height,0);