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
This commit is contained in:
parent
0eb5a5e6bb
commit
c4cbc5991d
2 changed files with 12 additions and 8 deletions
|
@ -117,7 +117,9 @@ class ImageIO extends Extension {
|
||||||
$memory_limit = get_memory_limit();
|
$memory_limit = get_memory_limit();
|
||||||
|
|
||||||
if($memory_use > $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);
|
$white = imagecolorallocate($thumb, 255, 255, 255);
|
||||||
$black = imagecolorallocate($thumb, 0, 0, 0);
|
$black = imagecolorallocate($thumb, 0, 0, 0);
|
||||||
imagefill($thumb, 0, 0, $white);
|
imagefill($thumb, 0, 0, $white);
|
||||||
|
@ -147,12 +149,12 @@ class ImageIO extends Extension {
|
||||||
/*
|
/*
|
||||||
* Check for an existing image
|
* Check for an existing image
|
||||||
*/
|
*/
|
||||||
if($row = $this->is_dupe($image->hash)) {
|
$existing = $database->get_image_by_hash($image->hash);
|
||||||
$iid = $row['id'];
|
if(!is_null($existing)) {
|
||||||
$page->add_main_block(new Block(
|
$page->add_main_block(new Block("Error uploading {$image->filename}",
|
||||||
"Error uploading {$image->filename}",
|
"Image <a href='".make_link("post/view/{$existing->id}")."'>{$existing->id}</a> ".
|
||||||
"Image <a href='".make_link("post/view/$iid")."'>$iid</a> ".
|
"already has hash {$image->hash}:<p>".
|
||||||
"already has hash {$image->hash}"));
|
build_thumb_html($existing)));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,9 @@ class RegenThumb extends Extension {
|
||||||
$memory_limit = get_memory_limit();
|
$memory_limit = get_memory_limit();
|
||||||
|
|
||||||
if($memory_use > $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);
|
$white = imagecolorallocate($thumb, 255, 255, 255);
|
||||||
$black = imagecolorallocate($thumb, 0, 0, 0);
|
$black = imagecolorallocate($thumb, 0, 0, 0);
|
||||||
imagefill($thumb, 0, 0, $white);
|
imagefill($thumb, 0, 0, $white);
|
||||||
|
|
Reference in a new issue