Trying to get phpthumb to work, but with a bit of issue at the moment. Got the simple demo to work, so I might be missing something on my function, but just can`t find what :(
The variables in this function have the following values:
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("
", $phpThumb->debugmessages).'</pre>';
}
$phpThumb->purgeTempFiles();
} else {
// do something with debug/error messages
echo '<form><textarea rows="25" cols="100" wrap="off">'.htmlentities(implode("
* ", $phpThumb->debugmessages)).'</textarea></form><hr>';
}
}
And here is the output error:
phpThumb() v1.7.11-201108081537 in file "phpthumb.class.php" on line 216 * setSourceData() setting $this->rawImageData (58 bytes; magic="E:\w" ( 0x45 0x3a 0x5c 0x77)) in file "phpthumb.class.php" on line 271 * file_exists() = 0 in file "phpthumb.class.php" on line 1165 * file_exists_ignoreopenbasedir() = 0 in file "phpthumb.class.php" on line 1166 * is_file() = 0 in file "phpthumb.class.php" on line 1167 * is_executable() = 0 in file "phpthumb.class.php" on line 1168 * ImageMagickThumbnailToGD() aborting because cannot find convert in $this->config_imagemagick_path (), and
which convert
returned () in file "phpthumb.class.php" on line 1198 * $AvailableImageOutputFormats = array(text;ico;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 * ResolveSource() exiting because $this->rawImageData is set (58 bytes) in file "phpthumb.class.php" on line 847 * setCacheDirectory() starting with config_cache_directory = "E:\wamp\www\mybb/inc\plugins\topposts\temp\" in file "phpthumb.class.php" on line 958 * setting config_cache_directory to realpath(E:\wamp\www\mybb\inc\plugins\topposts\temp) = "E:\wamp\www\mybb\inc\plugins\topposts\temp" in file "phpthumb.class.php" on line 986 * SetCacheFilename() _raw set from md5($this->rawImageData) = "9fcad44eb8ae21004afb1addf5f08404" in file "phpthumb.class.php" on line 3236 * SetCacheFilename() _par set from md5(_zcC_h100_w200_dpi150_q75) in file "phpthumb.class.php" on line 3273 * starting ExtractEXIFgetImageSize() in file "phpthumb.class.php" on line 3035 * skipping GetImageSize() because $this->sourceFilename is empty in file "phpthumb.class.php" on line 3047 * bypassing EXIF and GetImageSize sections because $this->rawImageData is set, and $this->sourceFilename is not set, and source image is not too large for GD (x=0MB) in file "phpthumb.class.php" on line 3065 * SetOrientationDependantWidthHeight() starting with ""x"" in file "phpthumb.class.php" on line 3014 * SetOrientationDependantWidthHeight() setting w="200", h="100" in file "phpthumb.class.php" on line 3030 * exif_thumbnail() does not exist, cannot extract EXIF thumbnail in file "phpthumb.class.php" on line 3138 * 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 * ImageCreateFromStringReplacement() calling built-in ImageCreateFromString() in file "phpthumb.class.php" on line 3956 * SourceImageToGD.ImageCreateFromStringReplacement() failed with unknown image type "E:\w" ( 0x45 0x3a 0x5c 0x77) in file "phpthumb.class.php" on line 3443 * 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.netUnknown image type identified by "E:\w" ( 0x45 0x3a 0x5c 0x77) in SourceImageToGD() [3647] in file "phpthumb.class.php" on line 3847 * SourceImageToGD() failed in file "phpthumb.class.php" on line 342
I`ve been over this for 5 hours (6am right now) and I just can't get it to work. Any help will be greatly appreciated.
thanks Eco