我已经花了一整天的时间,无法弄清楚我哪里出错了。
我正在尝试调整一些图像的大小,然后将它们写入一个文件夹,以便可以压缩和下载它们。
使用 phpThumb Demo -> phpThumb.demo.object.php 时,我可以让图像调整大小、重命名然后保存到另一个目录中。这是因为源图像、phpThumb 类和最终图像目标目录都在同一个文件夹中。
但是,我现在已经更改了目录结构,因此正在从管理子域调用 phpThumb.class.php 文件,并且需要从图像子域中获取图像,然后将其保存到图像或管理域中的目录中,所以我可以让他们稍后写入 ZIP 文件。
我只是一直在出错,无法确定从这里去哪里。任何人都可以帮忙吗?
这是php:
require_once('../phpThumb/phpthumb.class.php');
// create phpThumb object
$phpThumb = new phpThumb();
// create 3 sizes of thumbnail
$thumbnail_widths = array(160, 320, 1000);
$capture_raw_data = false; // set to true to insert to database rather than render to screen or file (see below)
foreach ($thumbnail_widths as $thumbnail_width) {
// this is very important when using a single object to process multiple images
$phpThumb->resetObject();
// set data source -- do this first, any settings must be made AFTER this call
$phpThumb->setSourceFilename('/home/server/domains/images.testdomain.co.uk/public_html/high-res/CM015585.jpg');
// PLEASE NOTE:
// You must set any relevant config settings here. The phpThumb
// object mode does NOT pull any settings from phpThumb.config.php
$phpThumb->setParameter('config_document_root', '/home/server/domains/images.testdomain.co.uk/public_html/');
$phpThumb->setParameter('config_cache_directory', '/home/server/domains/images.testdomain.co.uk/public_html/phpThumb/cache/');
$phpThumb->setParameter('w', $thumbnail_width);
// set options (see phpThumb.config.php)
// here you must preface each option with "config_"
$phpThumb->setParameter('config_output_format', 'jpg');
$phpThumb->setParameter('config_imagemagick_path', '/usr/local/bin/convert');
// generate & output thumbnail
$output_filename = 'zip_temp/_'.$thumbnail_width.'.'.$phpThumb->config_output_format;
echo $output_filename;
if ($phpThumb->GenerateThumbnail()) { // this line is VERY important, do not remove it!
$output_size_x = ImageSX($phpThumb->gdimg_output);
$output_size_y = ImageSY($phpThumb->gdimg_output);
if ($output_filename || $capture_raw_data) {
if ($capture_raw_data && $phpThumb->RenderOutput()) {
// RenderOutput renders the thumbnail data to $phpThumb->outputImageData, not to a file or the browser
//mysql_query("INSERT INTO `table` (`thumbnail`) VALUES ('".mysql_escape_string($phpThumb->outputImageData)."') WHERE (`id` = '".$id."')");
} elseif ($phpThumb->RenderToFile($output_filename)) {
// do something on success
echo 'Successfully rendered:<br><img src="http://images.testdomain.co.uk/zip_temp/'.$output_filename.'">';
} else {
// do something with debug/error messages
echo 'Failed (size='.$thumbnail_width.'):<pre>'.implode("\n\n", $phpThumb->debugmessages).'</pre>';
}
$phpThumb->purgeTempFiles();
} else {
$phpThumb->OutputThumbnail();
}
} else {
// do something with debug/error messages
echo 'Failed (size='.$thumbnail_width.').<br>';
echo '<div style="background-color:#FFEEDD; font-weight: bold; padding: 10px;">'.$phpThumb->fatalerror.'</div>';
echo '<form><textarea rows="10" cols="60" wrap="off">'.htmlentities(implode("\n* ", $phpThumb->debugmessages)).'</textarea></form><hr>';
}
}
以下是错误:
phpThumb() v1.7.11-201108081537 in file "phpthumb.class.php" on line 216
* phpThumb() v1.7.11-201108081537 in file "phpthumb.class.php" on line 216
* setSourceFilename(/home/server/domains/images.testdomain.co.uk/public_html/high-res/CM015585.jpg) set $this->sourceFilename to "/home/server/domains/images.testdomain.co.uk/public_html/high-res/CM015585.jpg" in file "phpthumb.class.php" on line 262
* Leaving $this->config_imagemagick_path as (/usr/local/bin/convert) because !is_execuatable(realpath($this->config_imagemagick_path)) () in file "phpthumb.class.php" on line 1162
* file_exists(/usr/local/bin/convert) = 0 in file "phpthumb.class.php" on line 1165
* file_exists_ignoreopenbasedir(/usr/local/bin/convert) = 0 in file "phpthumb.class.php" on line 1166
* is_file(/usr/local/bin/convert) = 0 in file "phpthumb.class.php" on line 1167
* is_executable(/usr/local/bin/convert) = 0 in file "phpthumb.class.php" on line 1168
* ImageMagickThumbnailToGD() aborting because cannot find convert in $this->config_imagemagick_path (/usr/local/bin/convert), and `which convert` returned (which: no convert in (/bin:/usr/bin)) in file "phpthumb.class.php" on line 1198
* $AvailableImageOutputFormats = array(text;ico;bmp;wbmp;gif;png;jpeg) in file "phpthumb.class.php" on line 923
* $this->thumbnailFormat set to $this->config_output_format "jpeg" in file "phpthumb.class.php" on line 934
* $this->thumbnailQuality set to "75" in file "phpthumb.class.php" on line 951
* ResolveFilenameToAbsolute() NOT prepending $this->config_document_root (/home/server/domains/images.testdomain.co.uk/public_html/) to $filename (/home/server/domains/images.testdomain.co.uk/public_html/high-res/CM015585.jpg) resulting in ($AbsoluteFilename = "/home/server/domains/images.testdomain.co.uk/public_html/high-res/CM015585.jpg") in file "phpthumb.class.php" on line 1060
* $this->sourceFilename set to "/home/server/domains/images.testdomain.co.uk/public_html/high-res/CM015585.jpg" in file "phpthumb.class.php" on line 852
* phpThumb() v1.7.11-201108081537
http://phpthumb.sourceforge.net
Error messages disabled in file "phpthumb.class.php" on line 3847
* setCacheDirectory() starting with config_cache_directory = "/home/server/domains/images.testdomain.co.uk/public_html/phpThumb/cache/" in file "phpthumb.class.php" on line 958
* setting config_cache_directory to realpath(/home/server/domains/images.testdomain.co.uk/public_html/phpThumb/cache) = "/home/server/domains/images.testdomain.co.uk/public_html/phpThumb/cache" in file "phpthumb.class.php" on line 986
* $this->config_cache_directory is not writable (/home/server/domains/images.testdomain.co.uk/public_html/phpThumb/cache) in file "phpthumb.class.php" on line 997
* SetCacheFilename() _src set from md5($this->sourceFilename) "/home/server/domains/images.testdomain.co.uk/public_html/high-res/CM015585.jpg" = "688d3d8dc707794f27b6ef6db51ee9a2" in file "phpthumb.class.php" on line 3240
* SetCacheFilename() _par set from md5(_w160_dpi150_q75) in file "phpthumb.class.php" on line 3273
* starting ExtractEXIFgetImageSize() in file "phpthumb.class.php" on line 3035
* GetImageSize(/home/server/domains/images.testdomain.co.uk/public_html/high-res/CM015585.jpg) says image is x in file "phpthumb.class.php" on line 3045
* GetImageSize("/home/server/domains/images.testdomain.co.uk/public_html/high-res/CM015585.jpg") failed in file "phpthumb.class.php" on line 3078
* $this->useRawIMoutput=true after checking $UnAllowedParameters in file "phpthumb.class.php" on line 1315
* ImageMagickThumbnailToGD() aborting because ImageMagickCommandlineBase() failed in file "phpthumb.class.php" on line 2006
* ImageMagickThumbnailToGD() failed in file "phpthumb.class.php" on line 3085
* SetOrientationDependantWidthHeight() starting with ""x"" in file "phpthumb.class.php" on line 3014
* SetOrientationDependantWidthHeight() setting w="160", h="0" in file "phpthumb.class.php" on line 3030
* EXIF thumbnail extraction: (size=0; type=""; 0x0) in file "phpthumb.class.php" on line 3142
* starting SourceImageToGD() in file "phpthumb.class.php" on line 3400
* starting ImageCreateFromFilename(/home/server/domains/images.testdomain.co.uk/public_html/high-res/CM015585.jpg) in file "phpthumb.class.php" on line 3315
* empty $filename or GetImageSize(/home/server/domains/images.testdomain.co.uk/public_html/high-res/CM015585.jpg) failed in file "phpthumb.class.php" on line 3364
* Populating $rawimagedata in file "phpthumb.class.php" on line 3372
* cannot fopen(/home/server/domains/images.testdomain.co.uk/public_html/high-res/CM015585.jpg) in file "phpthumb.class.php" on line 3383
* Not using EXIF thumbnail data because $this->exif_thumbnail_data is empty in file "phpthumb.class.php" on line 3471
* $this->gdimg_source is still empty in file "phpthumb.class.php" on line 3523
* ImageMagickThumbnailToGD() failed in file "phpthumb.class.php" on line 3525
* phpThumb() v1.7.11-201108081537
http://phpthumb.sourceforge.net
Error messages disabled in file "phpthumb.class.php" on line 3847
* SourceImageToGD() failed in file "phpthumb.class.php" on line 342