Thread: Cropping In PHP
View Single Post
Old 11-20-2009, 01:26 PM   #11 (permalink)
maeltar
The Acquainted
 
Join Date: Nov 2009
Location: nr Stratford-Upon-Avon
Posts: 137
Thanks: 3
maeltar is on a distinguished road
Default

Quote:
Originally Posted by mm88 View Post
Hi, Compliments! Great Code!

Only a question:

your script creates a 250 x 250 cropped thumb.

In which way can I modify the script to create a thumb with different width and height?

For example, to create a 400 (w) x 200 (h) cropped thumb ?


thanks!
At a quick glance, change the following..

Code:
function createThumb(){
		$thumbSize = 250; // will create a 250 x 250 thumb
		$this->thumb = imagecreatetruecolor($thumbSize, $thumbSize); 
		imagecopyresampled($this->thumb, $this->myImage, 0, 0,$this->x, $this->y, $thumbSize, $thumbSize, $this->cropWidth, $this->cropHeight); 
		}
to

Code:
function createThumb(){
		$thumbSize1 = 400;
                $thumbSize2 = 200;
		$this->thumb = imagecreatetruecolor($thumbSize1, $thumbSize2); 
		imagecopyresampled($this->thumb, $this->myImage, 0, 0,$this->x, $this->y, $thumbSize, $thumbSize, $this->cropWidth, $this->cropHeight); 
		}
__________________
Thanks... Simon

Sex, Drugs & Linux Rules
Send a message via MSN to maeltar
maeltar is offline  
Reply With Quote