Announcement

#1 2013-10-10 15:28:23

monkey
Member
2013-10-10
2

Problem with ImageMagick Relative Paths

Hi All,

When trying to create images (ie thumbnails) after doing a synchronize (I used the FTP method), nothing appeared to happen (apart from saying success on all files).  When I viewed the album, I had error icons on all images.

I looked in my apache logs and saw:

Code:

[Thu Oct 10 16:06:31.884936 2013] [:error] [pid 31220:tid 140157567530752] [client 192.168.21.100:50189] PHP Fatal error:  Uncaught exception 'ImagickException' with message 'unable to open image `././galleries/LensTesting/IMG_8952.JPG': No such file or directory @ error/blob.c/OpenBlob/2643' in /var/www/localhost/htdocs/admin/include/image.class.php:416\nStack trace:\n#0 /var/www/localhost/htdocs/admin/include/image.class.php(416): Imagick->__construct('././galleries/L...')\n#1 /var/www/localhost/htdocs/admin/include/image.class.php(87): image_imagick->__construct('././galleries/L...')\n#2 /var/www/localhost/htdocs/i.php(533): pwg_image->__construct('././galleries/L...')\n#3 {main}\n  thrown in /var/www/localhost/htdocs/admin/include/image.class.php on line 416, referer: http://gallery.local/index.php?/category/5

I performed some research and found that there is a problem with ImageMagick and relative paths.

This is my own server with the following build:

Code:

Piwigo version

        Piwigo 2.5.2
        Check for upgrade
        Subscribe garysalternateaddress@gmail.com to Piwigo Announcements Newsletter

Environment

        Operating system: Linux
        PHP: 5.5.4-pl0-gentoo (Show info) [2013-10-10 13:23:48]
        MySQL: 5.5.32-log [2013-10-10 23:23:48]
        Graphics Library: ImageMagick 6.8.6-8

Finally, I was able to fix this (not really knowing what I am doing) by editing image.class.php:

Code:

class image_imagick implements imageInterface
{
  var $image;

  function __construct($source_filepath)
  {
    // A bug cause that Imagick class can not be extended
    $this->image = new Imagick(__DIR__ . DIRECTORY_SEPARATOR . '../../' . $source_filepath);
  }
...

I'm not sure if this was the right thing to do, but now it appears that it is trying to thumbnail my pictures.  I'm sure I've created other problems, but at least it is no looking like it is creating images (the process is taking a lot longer this time).

Offline

 

#2 2013-10-10 15:33:04

monkey
Member
2013-10-10
2

Re: Problem with ImageMagick Relative Paths

I've just discovered in the same class I also neeed:

Code:

function write($destination_filepath)
  {
    // use 4:2:2 chroma subsampling (reduce file size by 20-30% with "almost" no human perception)
    $this->image->setSamplingFactors( array(2,1) );
    return $this->image->writeImage(__DIR__ . DIRECTORY_SEPARATOR . '../../' . $destination_filepath);
  }

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact