0

私はこれに一日中費やしましたが、どこが間違っているのかわかりません。

いくつかの画像のサイズを変更してフォルダーに書き込み、圧縮してダウンロードできるようにしようとしています。

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
4

1 に答える 1

0

ファイル phpthumb/phpthumb.class.php を開き、141 行目を次のように変更します。

var $config_disable_debug = true;

var $config_disable_debug = false;

元のページに再度アクセスすると、今度は実際のエラー メッセージが表示されます。

于 2012-09-27T10:04:21.670 に答える