summaryrefslogtreecommitdiffstats
path: root/phpfspot.class.php
diff options
context:
space:
mode:
authorAndreas Unterkircher <unki@netshadow.at>2008-03-28 17:20:19 +0100
committerAndreas Unterkircher <unki@netshadow.at>2008-03-28 17:20:19 +0100
commit8ab8f2cd84b981d1ae7272a05cd087a5f4924149 (patch)
tree94da9aaa51cc681d3a8eba236021317681c8ab56 /phpfspot.class.php
parent4d5edd97b940d6bc3bd5f701c41573620f6babc0 (diff)
issue109, support PNG format
Signed-off-by: Andreas Unterkircher <unki@netshadow.at>
Diffstat (limited to 'phpfspot.class.php')
-rw-r--r--phpfspot.class.php79
1 files changed, 49 insertions, 30 deletions
diff --git a/phpfspot.class.php b/phpfspot.class.php
index d6ecaed..cfa9257 100644
--- a/phpfspot.class.php
+++ b/phpfspot.class.php
@@ -460,8 +460,10 @@ class PHPFSPOT {
$thumb_path = $this->get_thumb_path($this->cfg->photo_width, $photo);
}
- /* get f-spot database meta information */
- $meta = $this->get_meta_informations($orig_path);
+ /* get EXIF information if JPEG */
+ if($details['mime'] == "image/jpeg") {
+ $meta = $this->get_meta_informations($orig_path);
+ }
/* If EXIF data are available, use them */
if(isset($meta['ExifImageWidth'])) {
@@ -1232,32 +1234,44 @@ class PHPFSPOT {
if(!$this->checkifImageSupported($details['mime']))
return false;
- $meta = $this->get_meta_informations($orig_image);
-
- $rotate = 0;
- $flip_hori = false;
- $flip_vert = false;
-
- switch($meta['Orientation']) {
- case 1: /* top, left */
- /* nothing to do */ break;
- case 2: /* top, right */
- $rotate = 0; $flip_hori = true; break;
- case 3: /* bottom, left */
- $rotate = 180; break;
- case 4: /* bottom, right */
- $flip_vert = true; break;
- case 5: /* left side, top */
- $rotate = 90; $flip_vert = true; break;
- case 6: /* right side, top */
- $rotate = 90; break;
- case 7: /* left side, bottom */
- $rotate = 270; $flip_vert = true; break;
- case 8: /* right side, bottom */
- $rotate = 270; break;
- }
-
- $src_img = @imagecreatefromjpeg($orig_image);
+ switch($details['mime']) {
+
+ case 'image/jpeg':
+
+ $meta = $this->get_meta_informations($orig_image);
+
+ $rotate = 0;
+ $flip_hori = false;
+ $flip_vert = false;
+
+ switch($meta['Orientation']) {
+ case 1: /* top, left */
+ /* nothing to do */ break;
+ case 2: /* top, right */
+ $rotate = 0; $flip_hori = true; break;
+ case 3: /* bottom, left */
+ $rotate = 180; break;
+ case 4: /* bottom, right */
+ $flip_vert = true; break;
+ case 5: /* left side, top */
+ $rotate = 90; $flip_vert = true; break;
+ case 6: /* right side, top */
+ $rotate = 90; break;
+ case 7: /* left side, bottom */
+ $rotate = 270; $flip_vert = true; break;
+ case 8: /* right side, bottom */
+ $rotate = 270; break;
+ }
+
+ $src_img = @imagecreatefromjpeg($orig_image);
+ break;
+
+ case 'image/png':
+
+ $src_img = @imagecreatefrompng($orig_image);
+ break;
+
+ }
if(!$src_img) {
print "Can't load image from ". $orig_image ."\n";
@@ -1803,7 +1817,7 @@ class PHPFSPOT {
*/
public function checkifImageSupported($mime)
{
- if(in_array($mime, Array("image/jpeg")))
+ if(in_array($mime, Array("image/jpeg", "image/png")))
return true;
return false;
@@ -2018,7 +2032,12 @@ class PHPFSPOT {
". $details['description']);
$orig_path = $this->translate_path($this->parse_uri($details['uri'], 'fullpath'));
- $meta = $this->get_meta_informations($orig_path);
+
+ /* get EXIF information if JPEG */
+ if($details['mime'] == "image/jpeg") {
+ $meta = $this->get_meta_informations($orig_path);
+ }
+
$meta_date = isset($meta['FileDateTime']) ? $meta['FileDateTime'] : filemtime($orig_path);
?>