[ansel] Patch to create thumbnail from EXIF data

Heath S. Hendrickson heath at outerspaceconsultants.com
Fri Jan 9 14:05:31 PST 2004


Okay, so hopefully this patch is a lot more useful than my watermark 
one...(gotta start somewhere, right).

Anyway, this is a patch to try and create the thumbnail image from the 
embedded EXIF thumbnail using the native PHP exif_thumbnail command.  I 
used the thumbnail preference sizes, but let it default to the format 
(the _thumb files created for me were PNG, which seems odd but I'm okay 
with that).

I found this necessary as images from my DSLR are generally 2MB in size 
and it takes _forever_ to create the thumbnails using resize.  This 
still won't speed up the creating of the screen resolution images any, 
but it's a start.

Can someone please test this out and verify that it's working properly?

heath


---- patch for Image.php ----
[root at space lib]# cvs diff Image.php
Index: Image.php
===================================================================
RCS file: /usr/local/horde/cvs/ansel/lib/Image.php,v
retrieving revision 1.18
diff -r1.18 Image.php
117,120c117,126
<             $dimensions = $this->_image->getDimensions();
<             
$this->_image->resize(min($this->_gallery->get('thumbnail_width'), 
$dimensions['width']),
<                                   
min($this->_gallery->get('thumbnail_height'), $dimensions['height']),
<                                   true);
---
 >             // Modified to look for a thumbnail in the EXIF data
 >             $image = exif_thumbnail($data, 
$this->_gallery->get('thumbnail_width'),
 >                                     
$this->_gallery->get('thumbnail_height'));
 >             if ($image==false) {
 >                // no thumbnail available, continue to create our own
 >                $dimensions = $this->_image->getDimensions();
 >                
$this->_image->resize(min($this->_gallery->get('thumbnail_width'), 
$dimensions['width']),
 >                                      
min($this->_gallery->get('thumbnail_height'), $dimensions['height']),
 >                                      true);
 >             }
------- end patch Image.php




More information about the ansel mailing list