php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62309 addImage() not working
Submitted: 2012-06-13 07:59 UTC Modified: 2016-05-20 21:55 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: carsten_sttgt at gmx dot de Assigned: vito (profile)
Status: Closed Package: gmagick (PECL)
PHP Version: 5.4.3 OS: Windows 7
Private report: No CVE-ID: None
 [2012-06-13 07:59 UTC] carsten_sttgt at gmx dot de
Description:
------------
Hello,

- PHP-5.4.3
- PECL gmagick-1.1.0RC3 (includes the attached patch)
- GraphicsMagick-1.3.13

Below is a working code with Imagick. But this doesn't work with Gmagick.


BTW:
I'm unsure where to set the ImageFormat with Gmagick. For each frame or for the complete image right before the writeImage()?

With Imagick I'm setting the the format with setFormat() one time at the beginning, after "$gmagick = new Gmagick();". But setFormat() doesn't exists in Gmagick, and setImageFormat() doesn't work at this place, becourse the image is empty at this time(--> exception empty Gmagick object).

Regards,
Carsten


Test script:
---------------
<?php
$gmagick = new Gmagick();

for ($i = 1; $i <= 3; $i++) {
    $frame = new Gmagick();
    $frame->readImage(sprintf('test%s.jpg', $i));
    $frame->setImageFormat('gif');
    $frame->setImageDelay(1000);

    $gmagick->addImage($frame);

    $frame->destroy();
}


$gmagick->writeImage('test.gif', true);

$gmagick->destroy();
?>


Expected result:
----------------
No exception.


Actual result:
--------------
[13-Jun-2012 07:48:12 UTC] PHP Fatal error:  Uncaught exception 'GmagickException' with message 'Can not process empty Gmagick object' in C:\Test\test.php:17
Stack trace:
#0 C:\Test\test.php(17): Gmagick->writeimage('test.gif', true)
#1 {main}
  thrown in C:\Test\test.php on line 17


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-04-10 15:08 UTC] imprec at gmail dot com
Helo, it seems you have to use it like this : 


$gmagick = new Gmagick();

for ($i = 1; $i <= 3; $i++) {
    $frame = new Gmagick();
    $frame->readImage(sprintf('test%s.jpg', $i));
    $frame->setImageFormat('gif');
    $frame->setImageDelay(1000);
    
    $gmagick->nextimage();
    $gmagick->addImage($frame);

    $frame->destroy();
}


It is an issue as Imagick works as you described it.
 [2013-04-10 19:48 UTC] imprec at gmail dot com
After having test more, my previous comment must be discarded as it's not solving 
the issue
 [2016-04-26 11:26 UTC] timon at dgngroep dot nl
Confirming this issue as well, as far as I am aware generating multi-page pdf files or animated gifs with Gmagick is broken because of this.
 [2016-05-20 21:55 UTC] vito@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: vito
 [2016-05-20 21:55 UTC] vito@php.net
Hi,

I think this is similar to:

https://github.com/vitoc/gmagick/issues/18

See @Danack's note.

This had been reported upstream here:

https://sourceforge.net/p/graphicsmagick/bugs/330/

Thanks.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun Dec 08 21:01:25 2019 UTC