PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Wed May 23, 2018 2:18 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Tue Apr 14, 2009 5:25 am 
Offline
Forum Newbie

Joined: Tue Apr 14, 2009 5:11 am
Posts: 2
we start with downloading the thumbnailer class from http://www.freelogic.pl/thumbnailer/ , then including the file and doin as follows:

Syntax: [ Download ] [ Hide ]
 
// create simple square thumb for every image we want
// with 100px width and height
 
$th=new Thumbnailer('some_photo.jpg');
$th->thumbSquare(100)->save('thumb_some_photo.jpg');
 


or we could create a thumb with any size we want using the fixed size method
Syntax: [ Download ] [ Hide ]
 
// 120px wide, 80px tall
 
$th=new Thumbnailer('any_photo.jpg');
$th->thumbFixed(120,80)->save('mythumb.jpg');
 


looks easy.. let say we have 200 photos from our camera - we want to process this directory and put those photos to our gallery:
Syntax: [ Download ] [ Hide ]
 
// creating callback function for batch mode
function callback(& $thumb) {
   // create symmetric photos (ratio will be 1:1)
   // (640px means, the larger width or height will have at max 640px)
   $thumb->thumbSymmetric(640)->save('/galleries/holiday_gallery/' . $thumb->getFilename());
 
   // create its thumb
   $thumb->thumbSquare(100)->save('/galleries/holiday_gallery/thumb_' . $thumb->getFilename());
}
 
// run batch mode
Thumbnailer::batch('callback', '/directory/with/photos/from/camera/');
 


very easy.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group