Image Magick erstellt keine Thumbnails

Hier können Probleme und alles andere in Deutscher Sprache gelöst werden.
Post Reply
Harald Weingaertner
Regular
Posts: 474
Joined: Mon Mar 27, 2006 12:32 am

Image Magick erstellt keine Thumbnails

Post by Harald Weingaertner »

Hi,

ich habe heute s9y 1.75 auf einem neuen Webserver installiert und habe bisher nur das eine Problem, dass Image Magick beim Bilderupload zwar durchläuft, aber es werden keine Thumbnails erstellt.

Diesen Thread hier bin ich schon komplett durchgegangen: http://board.s9y.org/viewtopic.php?f=10 ... age+magick

Image Magick ist wohl installiert und auch der von mir angegebene Pfad ist richtig. Die PHP Files (test.php) hatten folgendes ergeben:

is_executable exists File is executableFile IS_FILE
FOUND: /usr/bin/convert
Version: ImageMagick 6.7.1-7 2011-12-14 Q16 http://www.imagemagick.org

Nach einem Bilderupload wechselt s9y zurück in die Mediendatenbank. Der Upload klappt zwar, aber das ._Thumb liegt nur mit 0 Byte im Upload-Verzeichnis.

Hat zufällig jemand eine Idee, an was das liegen kann? Mit GDLib funktioniert das alles.

In s9y habe ich bei Image Magick das hier angegeben: /usr/bin/convert

Vielen Dank und Gruß, Harald
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Image Magick erstellt keine Thumbnails

Post by Timbalu »

Ist PHP mit imagemagick kompiliert bzw letzteres als extension eingebunden?
Aber ich sehe gerade, das alles müsstest du ja dann schon durch haben...
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Image Magick erstellt keine Thumbnails

Post by garvinhicking »

Hi!

Was erscheint denn wenn Du

Code: Select all

<?php
echo `/usr/local/bin/convert -help`;
?>
wie im Thread beschrieben ausführst? Wenn da keine Ausgabe erscheint, kann dein PHP die Imagemagick-Datei nicht ausführen...
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Harald Weingaertner
Regular
Posts: 474
Joined: Mon Mar 27, 2006 12:32 am

Re: Image Magick erstellt keine Thumbnails

Post by Harald Weingaertner »

Danke für die Antworten. Das Kuriose ist ja, dass conervt scheinbar ausgeführt werden kann, denn das PHP File gibt folgendes aus:



Version: ImageMagick 6.7.1-7 2011-12-14 Q16 http://www.imagemagick.org Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC Features: OpenMP Usage: convert [options ...] file [ [options ...] file ...] [options ...] file Image Settings: -adjoin join images into a single multi-image file -affine matrix affine transform matrix -alpha option activate, deactivate, reset, or set the alpha channel -antialias remove pixel-aliasing -authenticate password decipher image with this password -attenuate value lessen (or intensify) when adding noise to an image -background color background color -bias value add bias when convolving an image -black-point-compensation use black point compensation -blue-primary point chromaticity blue primary point -bordercolor color border color -caption string assign a caption to an image -channel type apply option to select image channels -colors value preferred number of colors in the image -colorspace type alternate image colorspace -comment string annotate image with comment -compose operator set image composite operator -compress type type of pixel compression when writing the image -define format:option define one or more image format options -delay value display the next image after pausing -density geometry horizontal and vertical density of the image -depth value image depth -direction type render text right-to-left or left-to-right -display server get image or font from this X server -dispose method layer disposal method -dither method apply error diffusion to image -encoding type text encoding type -endian type endianness (MSB or LSB) of the image -family name render text with this font family -fill color color to use when filling a graphic primitive -filter type use this filter when resizing an image -font name render text with this font -format "string" output formatted image characteristics -fuzz distance colors within this distance are considered equal -gravity type horizontal and vertical text placement -green-primary point chromaticity green primary point -intent type type of rendering intent when managing the image color -interlace type type of image interlacing scheme -interline-spacing value set the space between two text lines -interpolate method pixel color interpolation method -interword-spacing value set the space between two words -kerning value set the space between two letters -label string assign a label to an image -limit type value pixel cache resource limit -loop iterations add Netscape loop extension to your GIF animation -mask filename associate a mask with the image -mattecolor color frame color -monitor monitor progress -orient type image orientation -page geometry size and location of an image canvas (setting) -ping efficiently determine image attributes -pointsize value font point size -precision value maximum number of significant digits to print -preview type image preview type -quality value JPEG/MIFF/PNG compression level -quiet suppress all warning messages -red-primary point chromaticity red primary point -regard-warnings pay attention to warning messages -remap filename transform image colors to match this set of colors -respect-parentheses settings remain in effect until parenthesis boundary -sampling-factor geometry horizontal and vertical sampling factor -scene value image scene number -seed value seed a new sequence of pseudo-random numbers -size geometry width and height of image -stretch type render text with this font stretch -stroke color graphic primitive stroke color -strokewidth value graphic primitive stroke width -style type render text with this font style -synchronize synchronize image to storage device -taint declare the image as modified -texture filename name of texture to tile onto the image background -tile-offset geometry tile offset -treedepth value color tree depth -transparent-color color transparent color -undercolor color annotation bounding box color -units type the units of image resolution -verbose print detailed information about the image -view FlashPix viewing transforms -virtual-pixel method virtual pixel access method -weight type render text with this font weight -white-point point chromaticity white point Image Operators: -adaptive-blur geometry adaptively blur pixels; decrease effect near edges -adaptive-resize geometry adaptively resize image using 'mesh' interpolation -adaptive-sharpen geometry adaptively sharpen pixels; increase effect near edges -alpha option on, activate, off, deactivate, set, opaque, copy transparent, extract, background, or shape -annotate geometry text annotate the image with text -auto-gamma automagically adjust gamma level of image -auto-level automagically adjust color levels of image -auto-orient automagically orient (rotate) image -bench iterations measure performance -black-threshold value force all pixels below the threshold into black -blue-shift factor simulate a scene at nighttime in the moonlight -blur geometry reduce image noise and reduce detail levels -border geometry surround image with a border of color -bordercolor color border color -brightness-contrast geometry improve brightness / contrast of the image -cdl filename color correct with a color decision list -charcoal radius simulate a charcoal drawing -chop geometry remove pixels from the image interior -clamp restrict pixel range from 0 to the quantum depth -clip clip along the first path from the 8BIM profile -clip-mask filename associate a clip mask with the image -clip-path id clip along a named path from the 8BIM profile -colorize value colorize the image with the fill color -color-matrix matrix apply color correction to the image -contrast enhance or reduce the image contrast -contrast-stretch geometry improve contrast by `stretching' the intensity range -convolve coefficients apply a convolution kernel to the image -cycle amount cycle the image colormap -decipher filename convert cipher pixels to plain pixels -deskew threshold straighten an image -despeckle reduce the speckles within an image -distort method args distort images according to given method ad args -draw string annotate the image with a graphic primitive -edge radius apply a filter to detect edges in the image -encipher filename convert plain pixels to cipher pixels -emboss radius emboss an image -enhance apply a digital filter to enhance a noisy image -equalize perform histogram equalization to an image -evaluate operator value evaluate an arithmetic, relational, or logical expression -extent geometry set the image size -extract geometry extract area from image -fft implements the discrete Fourier transform (DFT) -flip flip image vertically -floodfill geometry color floodfill the image with color -flop flop image horizontally -frame geometry surround image with an ornamental border -function name parameters apply function over image values -gamma value level of gamma correction -gaussian-blur geometry reduce image noise and reduce detail levels -geometry geometry preferred size or location of the image -identify identify the format and characteristics of the image -ift implements the inverse discrete Fourier transform (DFT) -implode amount implode image pixels about the center -lat geometry local adaptive thresholding -layers method optimize, merge, or compare image layers -level value adjust the level of image contrast -level-colors color,color level image with the given colors -linear-stretch geometry improve contrast by `stretching with saturation' -liquid-rescale geometry rescale image with seam-carving -median geometry apply a median filter to the image -mode geometry make each pixel the 'predominant color' of the neighborhood -modulate value vary the brightness, saturation, and hue -monochrome transform image to black and white -morphology method kernel apply a morphology method to the image -motion-blur geometry simulate motion blur -negate replace every pixel with its complementary color -noise geometry add or reduce noise in an image -normalize transform image to span the full range of colors -opaque color change this color to the fill color -ordered-dither NxN add a noise pattern to the image with specific amplitudes -paint radius simulate an oil painting -polaroid angle simulate a Polaroid picture -posterize levels reduce the image to a limited number of color levels -profile filename add, delete, or apply an image profile -quantize colorspace reduce colors in this colorspace -radial-blur angle radial blur the image -raise value lighten/darken image edges to create a 3-D effect -random-threshold low,high random threshold the image -region geometry apply options to a portion of the image -render render vector graphics -repage geometry size and location of an image canvas -resample geometry change the resolution of an image -resize geometry resize the image -roll geometry roll an image vertically or horizontally -rotate degrees apply Paeth rotation to the image -sample geometry scale image with pixel sampling -scale geometry scale the image -segment values segment an image -selective-blur geometry selectively blur pixels within a contrast threshold -sepia-tone threshold simulate a sepia-toned photo -set property value set an image property -shade degrees shade the image using a distant light source -shadow geometry simulate an image shadow -sharpen geometry sharpen the image -shave geometry shave pixels from the image edges -shear geometry slide one edge of the image along the X or Y axis -sigmoidal-contrast geometry increase the contrast without saturating highlights or shadows -sketch geometry simulate a pencil sketch -solarize threshold negate all pixels above the threshold level -sparse-color method args fill in a image based on a few color points -splice geometry splice the background color into the image -spread radius displace image pixels by a random amount -statistic type geometry replace each pixel with corresponding statistic from the neighborhood -strip strip image of all profiles and comments -swirl degrees swirl image pixels about the center -threshold value threshold the image -thumbnail geometry create a thumbnail of the image -tile filename tile image when filling a graphic primitive -tint value tint the image with the fill color -transform affine transform image -transparent color make this color transparent within the image -transpose flip image vertically and rotate 90 degrees -transverse flop image horizontally and rotate 270 degrees -trim trim image edges -type type image type -unique-colors discard all but one of any pixel color -unsharp geometry sharpen the image -vignette geometry soften the edges of the image in vignette style -wave geometry alter an image along a sine wave -white-threshold value force all pixels above the threshold into white Image Sequence Operators: -append append an image sequence -clut apply a color lookup table to the image -coalesce merge a sequence of images -combine combine a sequence of images -composite composite image -crop geometry cut out a rectangular region of the image -deconstruct break down an image sequence into constituent parts -evaluate-sequence operator evaluate an arithmetic, relational, or logical expression -flatten flatten a sequence of images -fx expression apply mathematical expression to an image channel(s) -hald-clut apply a Hald color lookup table to the image -morph value morph an image sequence -mosaic create a mosaic from an image sequence -print string interpret string and print to console -process arguments process the image with a custom image filter -separate separate an image channel into a grayscale image -smush geometry smush an image sequence together -write filename write images to this file Image Stack Operators: -clone indexes clone an image -delete indexes delete the image from the image sequence -duplicate count,indexes duplicate an image one or more times -insert index insert last image into the image sequence -reverse reverse image sequence -swap indexes swap two images in the image sequence Miscellaneous Options: -debug events display copious debugging information -help print program options -list type print a list of supported option arguments -log format format of debugging information -version print version information By default, the image format of `file' is determined by its magic number. To specify a particular image format, precede the filename with an image format name and a colon (i.e. ps:image) or specify the image type as the filename suffix (i.e. image.ps). Specify 'file' as '-' for standard input or output.


Nur die Thumbnails werden halt nicht erstellt. (bzw. mit 0 Byte abgelegt). Merkwürdig. Laut Hoster stimmt auch alles, aber das sagen die ja meist.
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Image Magick erstellt keine Thumbnails

Post by Timbalu »

Auf der ImageMagick Seite gibt es kleine geeignete Testscripte, mit denen man bei sich die generelle Funktionalität außerhalb Serendipity leicht testen kann. Sollte sich herausstellen, dass es da schon hakt, kann man seinen Hoster damit belästigen, bzw Google auf die verwendete PHP Version mit eventuellen Imagemagick oder Imagick Bugs durchsuchen.
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Image Magick erstellt keine Thumbnails

Post by garvinhicking »

Hi!

OK, dann hier mal ein kleines Testscript zum ausprobieren (es geht von einer Datei "test.jpg" aus die im uploads/ Stammvereichnis liegt).

Code: Select all

<?php
include 'serendipity_config.inc.php';
$file = 'test.jpg';
$directory = '';

function debug_serendipity_makeThumbnail($file, $directory = '', $size = false, $thumbname = false, $is_temporary = false, $force_resize = false) {
    global $serendipity;

    if ($size === false) {
        $size = $serendipity['thumbSize'];
    }

    echo "Resizing with: " . $size . "<br />\n";
    
    if ($size < 1) {
       return array(0,0);
    }

    if ($thumbname === false) {
        $thumbname = $serendipity['thumbSuffix'];
    }

    $t       = serendipity_parseFileName($file);
    $f       = $t[0];
    $suf     = $t[1];


    $infile  = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $directory . $file;

    echo 'From: ' . $infile . '<br />';
    if ($is_temporary) {
        $temppath = dirname($thumbname);
        if (!is_dir($temppath)) {
            @mkdir($temppath);
        }
        $outfile = $thumbname;
    } else {
        $outfile = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $directory . $f . '.' . $thumbname . '.' . $suf;
    }
    $serendipity['last_outfile'] = $outfile;
    echo 'To: ' . $outfile . '<br />';

    $fdim    = @serendipity_getimagesize($infile, '', $suf);

    echo "DIM:" . print_r($fdim, true) . "<br />\n";

    if (isset($fdim['noimage'])) {
        $r = array(0, 0);
    } else {
        if ($serendipity['magick'] !== true) {
            if (is_array($size)) {
                // The caller wants a thumbnail with a specific size
                $r = serendipity_resize_image_gd($infile, $outfile, $size['width'], $size['height']);
            } else {
                // The caller wants a thumbnail constrained in the dimension set by config
                $calc = serendipity_calculate_aspect_size($fdim[0], $fdim[1], $size, $serendipity['thumbConstraint']);
                $r = serendipity_resize_image_gd($infile, $outfile, $calc[0], $calc[1]);
            }
        } else {
            if (is_array($size)) {
                $r = $size;
            } else {
                $calc = serendipity_calculate_aspect_size($fdim[0], $fdim[1], $size, $serendipity['thumbConstraint']);
                $r = array('width' => $calc[0], 'height' => $calc[1]);
            }
            $newSize = $r['width'] . 'x' . $r['height'];
            if ($fdim['mime'] == 'application/pdf') {
                $cmd     = escapeshellcmd($serendipity['convert']) . ' -antialias -flatten -scale '. serendipity_escapeshellarg($newSize) .' '. serendipity_escapeshellarg($infile . '[0]') . ' ' . serendipity_escapeshellarg($outfile . '.png');
            } else {
                if (!$force_resize && serendipity_ini_bool(ini_get('safe_mode')) === false) {
                    $newSize .= '>'; // Tell imagemagick to not enlarge small images, only works if safe_mode is off (safe_mode turns > in to \>)
                }
                $cmd     = escapeshellcmd($serendipity['convert']) . ' -antialias -resize '. serendipity_escapeshellarg($newSize) .' '. serendipity_escapeshellarg($infile) .' '. serendipity_escapeshellarg($outfile);
            }

            echo "Will execute: " . $cmd . "<br />\n";
            exec($cmd, $output, $result);
            echo "RESULT: " . $result . "<br />\n";
            if ($result != 0) {
                echo '<div class="serendipityAdminMsgError"><img style="width: 22px; height: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="' . serendipity_getTemplateFile('admin/img/admin_msg_error.png') . '" alt="" />' . sprintf(IMAGICK_EXEC_ERROR, $cmd, $output[0], $result) .'</div>';
                $r = false; // return failure
            } else {
               touch($outfile);
            }
            unset($output, $result);
        }
    }

    echo "Imageparse done.<br />\n";

    return $r;
}

debug_serendipity_makeThumbnail($file, $directory);

Grüße,
GArvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Harald Weingaertner
Regular
Posts: 474
Joined: Mon Mar 27, 2006 12:32 am

Re: Image Magick erstellt keine Thumbnails

Post by Harald Weingaertner »

Hmm, dieses Script sagt:

Mit Image Magick konfiguriert:
Resizing with: 240
From: /home/public_html/blog/uploads/test.jpg
To: /home/public_html/blog/uploads/test.x.jpg
DIM:Array ( [0] => 960 [1] => 717 [2] => 2 [3] => width="960" height="717" [bits] => 8 [channels] => 3 [mime] => image/jpeg )
Will execute: /usr/bin/convert -antialias -resize '240x179>' '/home/public_html/blog/uploads/test.jpg' '/home/public_html/blog/uploads/test.x.jpg'
RESULT:
Imageparse done.

und es liegt ein 0 Byte test.x.jpg im /uploads Ordner.

Das gleiche mit GD Lib im Blog konfiguriert sagt:
Resizing with: 240
From: /home/public_html/blog/uploads/test.jpg
To: /home/public_html/blog/uploads/test.x.jpg
DIM:Array ( [0] => 960 [1] => 717 [2] => 2 [3] => width="960" height="717" [bits] => 8 [channels] => 3 [mime] => image/jpeg )
Imageparse done.

und das kleine 27kb text.x.jpg liegt plötzlich im /uploads Ordner.

Hilft das irgendwie weiter?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Image Magick erstellt keine Thumbnails

Post by garvinhicking »

Hey,

ja, das heißt zumindest schonmal das grundsätzlich etwas passiert. Ich vermute, die convert Version deines Providers ist zu alt und kann die Parameter nicht korrekt übertragen.

Machmal ein neues test2.php script mit:

Code: Select all

<?php
$cmd = "/usr/bin/convert -antialias -resize '240x179' '/home/public_html/blog/uploads/test.jpg' '/home/public_html/blog/uploads/test.x.jpg'";
exec($cmd, $output, $result);
print_r($output);
print_r($result);
Ich schätze es liegt an dem resize Parameter der noch ein ">" eigentlich definiert [um dafür zu sorgen dass ein Bild nicht resizt wird, wenn es bereits kleiner als das gewünschte Maß ist].

Ggf. könnte es auch an der JPG-Datei selbst liegen die convert evtl nicht lesen kann. Probier sowas am besten auch mal mit PNG oder GIF Dateien aus, nur um sicherzugehen dass es nicht am JPG liegt.

Grüße,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Harald Weingaertner
Regular
Posts: 474
Joined: Mon Mar 27, 2006 12:32 am

Re: Image Magick erstellt keine Thumbnails

Post by Harald Weingaertner »

Danke für Deine Hilfe. Das neue Skript gibt gar nichts aus. Nur weiße Zeichen. Die Pfade stimmen aber.

Die convert Version müsste doch oben ausgegeben worden sein, oder? (Version: ImageMagick 6.7.1-7)

Sollte ich ihn mal bitten mir die aktuelle Version zur Verfügung zu stellen?

Ich kann aber scheinbar auch nicht direkt aus PHP per exec Befehle ausführen und habe es mit passthru versucht. Ich hoffe, dass ich dabei keinen Fehler gemacht habe. Aber die 0 Byte Größe könnte ja vielleicht schon auf eine alte Version hindeuten, oder?

Gruß, Harald
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Image Magick erstellt keine Thumbnails

Post by garvinhicking »

Harald Weingaertner wrote:Danke für Deine Hilfe. Das neue Skript gibt gar nichts aus. Nur weiße Zeichen. Die Pfade stimmen aber.
Das keine Ausgabe kommt ist ok, wenn alles klappt gibt convert nichts zurück. Ist die Datei nach ausführen des Scripts denn immer noch 0 Byte, und aktuelle Systemzeit?
Ich kann aber scheinbar auch nicht direkt aus PHP per exec Befehle ausführen und habe es mit passthru versucht. Ich hoffe, dass ich dabei keinen Fehler gemacht habe. Aber die 0 Byte Größe könnte ja vielleicht schon auf eine alte Version hindeuten, oder?

Eigentlich müsstest du das können, denn sonst würdest Du auch die andere ausgabe gar nicht sehen.

Grüße,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Harald Weingaertner
Regular
Posts: 474
Joined: Mon Mar 27, 2006 12:32 am

Re: Image Magick erstellt keine Thumbnails

Post by Harald Weingaertner »

garvinhicking wrote:
Harald Weingaertner wrote:Danke für Deine Hilfe. Das neue Skript gibt gar nichts aus. Nur weiße Zeichen. Die Pfade stimmen aber.
Das keine Ausgabe kommt ist ok, wenn alles klappt gibt convert nichts zurück. Ist die Datei nach ausführen des Scripts denn immer noch 0 Byte, und aktuelle Systemzeit?
Hi Garvin, ja 0 Byte und aktuelle Systemzeit. Dann wird es wohl auch nicht an einer alten Version liegen. Ich denke, dass ich dann einfach mit GDLib leben werden. Es scheint ja nicht an s9y zu liegen, sonst hätten noch andere das Problem. :(
Post Reply