hi, using php5 5.2.0, imagemagick 6.4.2 and imagick api 2.1.1. I'm using the following code:
$im=new Imagick("image.ext");
header('Content-type: image/type');
echo $im;
for displaying a JPEG-file or PNG-file this works fine, also for GIFs, but not for animated GIFs. imagick seems to load only the first frame. with function readImage nothing is changed. so, what can I do?
nico
PHP API and displaying animated gif's doesn't work?
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: PHP API and displaying animated gif's doesn't work?
That is not the right way to export a image.
If you are using a API, which it looks like, you convert the image into a 'blob' that is the right format. If using command calls from PHP, you can have the command output the image in the format wanted using png:- or whatever.
If you are using a API, which it looks like, you convert the image into a 'blob' that is the right format. If using command calls from PHP, you can have the command output the image in the format wanted using png:- or whatever.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: PHP API and displaying animated gif's doesn't work?
ok, I understand, but after trying for a while, I don't get things to work with php-api. With
$image=get_file_contents("pic.gif");
header('Content...');
echo $image;
alls works fine, but not the imagick api. I tried
$image=new Imagick();
$image->readImage("pic.gif");
header('Content...');
echo $image->getImageBlob();
and tried also to add
foreach ($image as $frame)
$frame->cropImage($width, $height, 0, 0);
but nothing seems to work. Confusing, but
$content=file_get_contents("pic.gif");
$image=new Imagick();
$image->readImageBlob($content);
echo $image->getImageBlob();
doesn't work, too. All experiments show only the first frame of the gif.
$image=get_file_contents("pic.gif");
header('Content...');
echo $image;
alls works fine, but not the imagick api. I tried
$image=new Imagick();
$image->readImage("pic.gif");
header('Content...');
echo $image->getImageBlob();
and tried also to add
foreach ($image as $frame)
$frame->cropImage($width, $height, 0, 0);
but nothing seems to work. Confusing, but
$content=file_get_contents("pic.gif");
$image=new Imagick();
$image->readImageBlob($content);
echo $image->getImageBlob();
doesn't work, too. All experiments show only the first frame of the gif.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: PHP API and displaying animated gif's doesn't work?
You should be able to specify the output image format for the blob somehow!
$image=new Imagick();
$image->readImage("pic.gif");
header('Content...');
$image->writeimage("gif:-");
I think you should search and/or post in the PHP IM forum.
This is not my normal API of choice, and I don't use it regually.
$image=new Imagick();
$image->readImage("pic.gif");
header('Content...');
$image->writeimage("gif:-");
I think you should search and/or post in the PHP IM forum.
This is not my normal API of choice, and I don't use it regually.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/