From c4cbc5991da78dd655b2317da3e6825b7593b570 Mon Sep 17 00:00:00 2001 From: shish Date: Tue, 1 May 2007 12:38:28 +0000 Subject: [PATCH] fix error when generating image_too_large, and show thumb on dupe upload git-svn-id: file:///home/shish/svn/shimmie2/trunk@39 7f39781d-f577-437e-ae19-be835c7a54ca --- core/ext/image.ext.php | 16 +++++++++------- ext/regen_thumb.ext.php | 4 +++- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/core/ext/image.ext.php b/core/ext/image.ext.php index 6f975ab4..ed97c2a0 100644 --- a/core/ext/image.ext.php +++ b/core/ext/image.ext.php @@ -117,7 +117,9 @@ class ImageIO extends Extension { $memory_limit = get_memory_limit(); if($memory_use > $memory_limit) { - $thumb = imagecreatetruecolor($max_width, min($max_height, 64)); + $w = $config->get_int('thumb_width'); + $h = $config->get_int('thumb_height'); + $thumb = imagecreatetruecolor($w, min($h, 64)); $white = imagecolorallocate($thumb, 255, 255, 255); $black = imagecolorallocate($thumb, 0, 0, 0); imagefill($thumb, 0, 0, $white); @@ -147,12 +149,12 @@ class ImageIO extends Extension { /* * Check for an existing image */ - if($row = $this->is_dupe($image->hash)) { - $iid = $row['id']; - $page->add_main_block(new Block( - "Error uploading {$image->filename}", - "Image $iid ". - "already has hash {$image->hash}")); + $existing = $database->get_image_by_hash($image->hash); + if(!is_null($existing)) { + $page->add_main_block(new Block("Error uploading {$image->filename}", + "Image {$existing->id} ". + "already has hash {$image->hash}:

". + build_thumb_html($existing))); return false; } diff --git a/ext/regen_thumb.ext.php b/ext/regen_thumb.ext.php index 291f5141..4c84c505 100644 --- a/ext/regen_thumb.ext.php +++ b/ext/regen_thumb.ext.php @@ -87,7 +87,9 @@ class RegenThumb extends Extension { $memory_limit = get_memory_limit(); if($memory_use > $memory_limit) { - $thumb = imagecreatetruecolor($max_width, min($max_height, 64)); + $w = $config->get_int('thumb_width'); + $h = $config->get_int('thumb_height'); + $thumb = imagecreatetruecolor($w, min($h, 64)); $white = imagecolorallocate($thumb, 255, 255, 255); $black = imagecolorallocate($thumb, 0, 0, 0); imagefill($thumb, 0, 0, $white);