Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/262.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PhpThumb错误_Php_Phpthumb - Fatal编程技术网

PhpThumb错误

PhpThumb错误,php,phpthumb,Php,Phpthumb,试图让phpthumb工作,但目前有点问题。 让这个简单的演示开始工作,所以我可能在我的函数中遗漏了一些东西,但就是找不到什么:( 此函数中的变量具有以下值: MYBB\u ROOT=E:\wamp\www\MYBB/ 源地址= target_file=E:\wamp\www\mybb/images/topposts/thumbnails/thumb_13863.jpg thumb_file_name=thumb_13863.jpg 函数tp\u createThumb($source\u ur

试图让phpthumb工作,但目前有点问题。 让这个简单的演示开始工作,所以我可能在我的函数中遗漏了一些东西,但就是找不到什么:(

此函数中的变量具有以下值:

MYBB\u ROOT=E:\wamp\www\MYBB/ 源地址= target_file=E:\wamp\www\mybb/images/topposts/thumbnails/thumb_13863.jpg thumb_file_name=thumb_13863.jpg

函数tp\u createThumb($source\u url、$target\u file、$thumb\u file\u name){
需要一次MYBB_ROOT.inc/plugins/topposts/phpthumb.class.php';
需要一次MYBB_ROOT.inc/plugins/topposts/phpThumb.config.php';
//创建phpThumb对象
$phpThumb=新的phpThumb();
//下载文件
echo(“URL:.$source\u URL);
下载文件($source\u url,MYBB\u ROOT.inc\\plugins\\topposts\temp\\'.$thumb\u file\u name);
//设置数据源--首先执行此操作,在此调用之后必须进行任何设置
$phpThumb->setSourceData(MYBB_ROOT.inc\\plugins\\topposts\temp\\'.$thumb\u file\u name);
echo('source:'.MYBB\u ROOT.inc\\plugins\\topposts\temp\\'.$thumb\u file\u name);
//请注意:
//您必须在此处设置任何相关的配置设置。phpThumb
//对象模式不会从phpThumb.config.php提取任何设置
//设置参数(请参阅phpthumb.readme.txt中的URL参数)
$thumbnail_width=100;
$phpThumb->setParameter('w',$thumbnail\u width);
$phpThumb->setParameter('nohotlink_enabled','false');
$phpThumb->setParameter('config_output_format','jpeg');
$phpThumb->setParameter('zc','C');
$phpThumb->setParameter('config_allow_src_over_docroot',true);
$phpThumb->setParameter('w',200);
$phpThumb->setParameter('h',100);
$phpThumb->setParameter('config\u cache\u disable\u warning',true);
$phpThumb->setParameter('config\u imagemagick\u path',null);
$phpThumb->setParameter('config_preference_imagemagick',false);
//生成并输出缩略图
如果($phpThumb->GenerateThumbnail()){//这一行非常重要,请不要删除它!
如果($phpThumb->RenderToFile($output_filename)){
//为成功做点什么
echo“已成功呈现到“.$output_filename.”;
}否则{
//处理调试/错误消息
echo“Failed bla:”。内爆(\n\n“,$phpThumb->debugmessages)。“”;
unction 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';

    echo(" MYBB_ROOT=".MYBB_ROOT." source_url=".$source_url." target_file=".$target_file." thumb_file_name=".$thumb_file_name);
    // 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(file_get_contents(MYBB_ROOT.'inc/plugins/topposts/temp/'.$thumb_file_name));
    //$phpThumb->setSourceData(file_get_contents(MYBB_ROOT.'inc/plugins/topposts/temp/thumb_13863.jpg'));
    echo (' source:./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_directory','./topposts/temp/');
    $phpThumb->setParameter('config_temp_directory', './topposts/temp/');
    $phpThumb->setParameter('config_cache_disable_warning', true);
    $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($target_file)) {
            // do something on success
            echo 'Successfully rendered to "'.$target_file.'"';
        } 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="55" cols="120" wrap="off">'.htmlentities(implode("\n* ", $phpThumb->debugmessages)).'</textarea></form><hr>';
    }
}
} $phpThumb->purgeTempFiles(); }否则{ //处理调试/错误消息 echo'.htmlentities(内爆(“\n*”,$phpThumb->debugmessages))。
; } }
以下是输出错误:

phpThumb()v1.7.11-201108081537,文件“phpThumb.class.php”在线 216 *setSourceData()在第271行的文件“phpthumb.class.php”中设置$this->rawmagedata(58字节;magic=“E:\w”(0x45 0x3a 0x5c 0x77)) *第1165行文件“phpthumb.class.php”中的文件_exists()=0 *第1166行的文件“phpthumb.class.php”中存在文件\u ignoreopenbasedir()=0 *第1167行文件“phpthumb.class.php”中的_file()是否为0 *第1168行文件“phpthumb.class.php”中的可执行文件()是否为0 *ImageMagickThumbnailToGD()正在中止,因为在$this->config\u imagemagick\u path()中找不到转换,并且在 第1198行的文件“phpthumb.class.php” *$AvailableImageOutputFormats=第923行文件“phpthumb.class.php”中的数组(文本;ico;wbmp;gif;png;jpeg) *$this->thumbnailFormat设置为$this->config_output_format“jpeg”,位于第934行的文件“phpthumb.class.php”中 *$this->thumbnailQuality在第951行的文件“phpthumb.class.php”中设置为“75” *ResolveSource()正在退出,因为在第847行的文件“phpthumb.class.php”中设置了$this->rawmagedata(58字节) *setCacheDirectory()以文件中的config\u cache\u directory=“E:\wamp\www\mybb/inc\plugins\topposts\temp\”开头 第958行的“phpthumb.class.php” *将config\u cache\u目录设置为realpath(E:\wamp\www\mybb\inc\plugins\topposts\temp)= 文件中的“E:\wamp\www\mybb\inc\plugins\topposts\temp” 第986行的“phpthumb.class.php” *SetCacheFilename()(u来自md5的原始集($this->rawmagedata)=“9fcad44eb8ae21004afb1addf5f08404”位于 第3236行 *SetCacheFilename()(从第3273行的文件“phpthumb.class.php”中的md5(_zcC_h100_w200_dpi150_q75)中设置 *正在第3035行的文件“phpthumb.class.php”中启动ExtractEXIFgetImageSize() *跳过GetImageSize(),因为第3047行的文件“phpthumb.class.php”中的$this->sourceFilename为空 *绕过EXIF和GetImageSize部分,因为设置了$this->rawmageData,未设置$this->sourceFilename,且未设置源图像 第3065行的文件“phpthumb.class.php”中的GD(x=0MB)太大 *setOrientationDependentWidthHeight()在第3014行的文件“phpthumb.class.php”中以“x”开头 *setOrientationDependentWidthHeight()在第3030行的文件“phpthumb.class.php”中设置w=“200”,h=“100” *exif_缩略图()不存在,无法在第3138行的文件“phpthumb.class.php”中提取exif缩略图 *EXIF缩略图提取:(size=0;type=”“;0x0)在第3142行的文件“phpthumb.class.php”中 *在第3400行的文件“phpthumb.class.php”中启动SourceImageToGD() *ImageCreateFromStringReplacement()调用第3956行文件“phpthumb.class.php”中的内置ImageCreateFromString() *SourceImageToGD.ImageCreateFromStringReplacement()失败,文件中的图像类型为未知的“E:\w”(0x45 0x3a 0x5c 0x77) 第3443行的“phpthumb.class.php” *不使用EXIF缩略图数据,因为第3471行的文件“phpthumb.class.php”中的$this->EXIF_缩略图_数据为空 *$this->gdimg_source在第3523行的文件“phpthumb.class.php”中仍然为空 *ImageMagickThumbnailToGD()在第3525行的文件“phpthumb.class.php”中失败 *phpThumb()v1.7.11-201108081537

中由“E:\w”(0x45 0x3a 0x5c 0x77)标识的未知图像类型 SourceImageToGD()[3647]位于第3847行的文件“phpthumb.class.php”中 *SourceImageToGD()
unction 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';

    echo(" MYBB_ROOT=".MYBB_ROOT." source_url=".$source_url." target_file=".$target_file." thumb_file_name=".$thumb_file_name);
    // 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(file_get_contents(MYBB_ROOT.'inc/plugins/topposts/temp/'.$thumb_file_name));
    //$phpThumb->setSourceData(file_get_contents(MYBB_ROOT.'inc/plugins/topposts/temp/thumb_13863.jpg'));
    echo (' source:./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_directory','./topposts/temp/');
    $phpThumb->setParameter('config_temp_directory', './topposts/temp/');
    $phpThumb->setParameter('config_cache_disable_warning', true);
    $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($target_file)) {
            // do something on success
            echo 'Successfully rendered to "'.$target_file.'"';
        } 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="55" cols="120" wrap="off">'.htmlentities(implode("\n* ", $phpThumb->debugmessages)).'</textarea></form><hr>';
    }
}