2012-10-11 35 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/' ;