2012-10-11 36 views
1

我在PHP構建畫廊。 我決定EasyPhpThumbnail融入我的項目。EasyPhpThumbnail動態裁剪

我遇到的問題是建立。

也許有人已經用這個類之前,可以分享經驗。如果有其他課程的任何建議 - 我會很樂意聽到他們。

我要動態地裁剪已上載的圖像。我想將縮略圖大小設置爲特定的寬度和高度。

有什麼建議嗎?

我的代碼現在看起來像這樣:

$thumb = new Classes_Images_EasyThumbMaker(); 
$thumb -> Cropimage = array(1,0,20,20,35,35); // maybe something should be set here.        
$thumb -> Thumbwidth = 205; 
$thumb -> Thumbheight = 156; 
$thumb -> Quality = 100; 
// Full path to the images 
$pathToImage = 'uploads/portfolio/original/' . basename($form->image->getFileName()); 
//$thumb -> Chmodlevel = '0755'; 
$thumb -> Thumblocation = 'uploads/portfolio/thumb/'; 
$thumb -> Thumbprefix = 'thumb_'; 
// Create the thumbnail and save it 
$thumb ->Createthumb($pathToImage, 'file'); 

回答

0

您可能需要使用絕對路徑文件,像這樣:

// Your full path to the images 
$dir = str_replace(chr(92),chr(47),getcwd()) . 'uploads/' ;