summaryrefslogtreecommitdiffstats
path: root/phpfspot.class.php
diff options
context:
space:
mode:
authorAndreas Unterkircher <unki@netshadow.at>2007-07-15 09:31:55 +0000
committerAndreas Unterkircher <unki@netshadow.at>2007-07-15 09:31:55 +0000
commit0a5ca001b9b7a676d6c7671e7fb016110137cd04 (patch)
treecda135f7f77da8c3a311a36ff02dc248d3c41bb6 /phpfspot.class.php
parenta552181a7fe679d8aebc24d75f61dcfe445b9f04 (diff)
issue43, also return a thumbnail if requested width is below image size
git-svn-id: file:///var/lib/svn/phpfspot/trunk@208 fa6a889d-dae6-447d-9e79-4ba9a3039384
Diffstat (limited to 'phpfspot.class.php')
-rw-r--r--phpfspot.class.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/phpfspot.class.php b/phpfspot.class.php
index 7d58ffe..00c84db 100644
--- a/phpfspot.class.php
+++ b/phpfspot.class.php
@@ -716,8 +716,9 @@ class PHPFSPOT {
public function create_thumbnail($orig_image, $thumb_image, $width)
{
- if(!file_exists($orig_image))
+ if(!file_exists($orig_image)) {
return false;
+ }
$details = getimagesize($orig_image);
@@ -762,9 +763,11 @@ class PHPFSPOT {
$cur_height = imagesy($src_img);
// If requested width is more then the actual image width,
- // do not generate a thumbnail
+ // do not generate a thumbnail, instead safe the original
+ // as thumbnail but with lower quality
if($width >= $cur_width) {
+ $result = imagejpeg($src_img, $thumb_image, 75);
imagedestroy($src_img);
return true;
}
@@ -918,7 +921,6 @@ class PHPFSPOT {
if(!$this->create_thumbnail($full_path, $thumb_path, $resolution))
$error = 1;
}
-
/* if the file hasn't changed there is no need to regen the thumb */
elseif($file_md5 != $this->getMD5($idx) || $force) {