phpthumb を動作させようとしていますが、現時点では少し問題があります。簡単なデモが機能するようになったので、関数に何かが欠けている可能性がありますが、何が見つかりません:(
この関数の変数には次の値があります。
MYBB_ROOT=E:\wamp\www\mybb/ source_url= http://www.theblaze.com/wp-content/uploads/2013/04/Screen-Shot-2013-04-29-at-7.41.26-AM .png target_file=E:\wamp\www\mybb/images/topposts/thumbnails/thumb_13863.jpg thumb_file_name=thumb_13863.jpg
function tp_createThumb($source_url,$target_file, $thumb_file_name){
require_once MYBB_ROOT.'inc/plugins/topposts/phpthumb.class.php';
require_once MYBB_ROOT.'inc/plugins/topposts/phpThumb.config.php';
// create phpThumb object
$phpThumb = new phpthumb();
//download file
echo ("URL:".$source_url);
downloadFile($source_url, MYBB_ROOT.'inc\\plugins\\topposts\temp\\'.$thumb_file_name);
// set data source -- do this first, any settings must be made AFTER this call
$phpThumb->setSourceData(MYBB_ROOT.'inc\\plugins\\topposts\temp\\'.$thumb_file_name);
echo (' source:'.MYBB_ROOT.'inc\\plugins\\topposts\temp\\'.$thumb_file_name);
// PLEASE NOTE:
// You must set any relevant config settings here. The phpThumb
// object mode does NOT pull any settings from phpThumb.config.php
// set parameters (see URL Parameters in phpthumb.readme.txt)
$thumbnail_width = 100;
$phpThumb->setParameter('w', $thumbnail_width);
$phpThumb->setParameter('nohotlink_enabled', 'false');
$phpThumb->setParameter('config_output_format', 'jpeg');
$phpThumb->setParameter('zc', "C");
$phpThumb->setParameter('config_allow_src_above_docroot', true);
$phpThumb->setParameter('w', 200);
$phpThumb->setParameter('h', 100);
$phpThumb->setParameter('config_cache_disable_warning', true);
$phpThumb->setParameter('config_imagemagick_path', null);
$phpThumb->setParameter('config_prefer_imagemagick', false);
// generate & output thumbnail
if ($phpThumb->GenerateThumbnail()) { // this line is VERY important, do not remove it!
if ($phpThumb->RenderToFile($output_filename)) {
// do something on success
echo 'Successfully rendered to "'.$output_filename.'"';
} else {
// do something with debug/error messages
echo 'Failed bla:<pre>'.implode("\n\n", $phpThumb->debugmessages).'</pre>';
}
$phpThumb->purgeTempFiles();
} else {
// do something with debug/error messages
echo '<form><textarea rows="25" cols="100" wrap="off">'.htmlentities(implode("\n* ", $phpThumb->debugmessages)).'</textarea></form><hr>';
}
}
そして、ここに出力エラーがあります:
ファイル「phpthumb.class.php」の 216 行目の phpThumb() v1.7.11-201108081537 * setSourceData() $this->rawImageData (58 バイト; magic="E:\w" ( 0x45 0x3a 0x5c 0x77)) を設定271 行目のファイル "phpthumb.class.php" * file_exists() = 1165 行目のファイル "phpthumb.class.php" で 0 * file_exists_ignoreopenbasedir() = 1166 行目のファイル "phpthumb.class.php" で * is_file( ) = ファイル "phpthumb.class.php" の 1167 行で 0 * is_executable() = ファイル "phpthumb.class.php" の 1168 行で 0 * $this->config_imagemagick_path () で変換が見つからないため、ImageMagickThumbnailToGD() は中止されます、 と
which convert
ファイル「phpthumb.class.php」の 1198 行目に () が返されました * $AvailableImageOutputFormats = array(text;ico;wbmp;gif;png;jpeg) ファイル「phpthumb.class.php」の 923 行目に * $this->ファイル "phpthumb.class.php" の 934 行で、thumbnailFormat を $this->config_output_format "jpeg" に設定 * ファイル "phpthumb.class.php" の 951 行で $this->thumbnailQuality を "75" に設定 * ResolveSource() $this->rawImageData がファイル "phpthumb.class.php" の 847 行目に設定されているため (58 バイト) 終了 * config_cache_directory = "E:\wamp\www\mybb/inc\plugins\topposts\temp で始まる setCacheDirectory() \" ファイル "phpthumb.class.php" の 958 行 * config_cache_directory を realpath(E:\wamp\www\mybb\inc\plugins\topposts\temp) に設定 = "E:\wamp\www\mybb\inc\plugins\topposts\temp" ファイル "phpthumb.class.php" の 986 行 * SetCacheFilename() _raw set from md5($this->rawImageData) = "9fcad44eb8ae21004afb1addf5f08404" ファイル "phpthumb .class.php" 3236 行 * 3273 行のファイル "phpthumb.class.php" の md5(_zcC_h100_w200_dpi150_q75) から SetCacheFilename() _par を設定 * 3035 行のファイル "phpthumb.class.php" で ExtractEXIFgetImageSize() を開始 * スキップGetImageSize() は、3047 行目のファイル "phpthumb.class.php" で $this->sourceFilename が空であるため * $this->rawImageData が設定され、$this->sourceFilename が設定されておらず、source が設定されているため、EXIF および GetImageSize セクションをバイパスします。ファイル "phpthumb.class.php" の画像は GD (x=0MB) に対して大きすぎません3065 行目 * ファイル "phpthumb.class.php" で ""x" から始まる SetOrientationDependantWidthHeight() 3014 行目 * SetOrientationDependantWidthHeight() で w="200", h="100" をファイル "phpthumb.class.php" に設定" 行 3030 * exif_thumbnail() が存在しないため、ファイル "phpthumb.class.php" の EXIF サムネイルを抽出できません 行 3138 * EXIF サムネイルの抽出: (size=0; type=""; 0x0) ファイル "phpthumb. class.php" を 3142 行で * ファイル "phpthumb.class.php" で SourceImageToGD() を 3400 行で開始 * ImageCreateFromStringReplacement() でファイル "phpthumb.class.php" で組み込みの ImageCreateFromString() を呼び出して 3956 行で * SourceImageToGD. ImageCreateFromStringReplacement() が不明なイメージ タイプ "E:\w" で失敗しました( 0x45 0x3a 0x5c 0x77) ファイル "phpthumb.class.php" の 3443 行 * $this->exif_thumbnail_data がファイル "phpthumb.class.php" の 3471 行で空であるため、EXIF サムネイル データを使用しない * $this->gdimg_sourceファイル「phpthumb.class.php」の 3523 行目はまだ空です * ImageMagickThumbnailToGD() は、ファイル「phpthumb.class.php」の 3525 行目で失敗しました * phpThumb() v1.7.11-201108081537http://phpthumb.sourceforge.netファイル「phpthumb.class.php」の 3847 行目の SourceImageToGD() [3647] の「E:\w」( 0x45 0x3a 0x5c 0x77) で識別される不明な画像タイプ * ファイル「phpthumb.class.php」で SourceImageToGD() が失敗しました342行目
私はこれを 5 時間 (現在午前 6 時) 続けてきましたが、うまくいきません。どんな助けでも大歓迎です。
ありがとうエコ