[PHP] error/blob.c/OpenBlob/2641

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
embers
Posts: 4
Joined: 2017-07-18T17:12:55-07:00
Authentication code: 1151

[PHP] error/blob.c/OpenBlob/2641

Post by embers »

Hello,

I have been Googling

Code: Select all

error/blob.c/OpenBlob/2641
for the past two days trying to figure this issue out, but to little effect.

I am using Imagemagick within PHP, with the following code:

Code: Select all

$imagick = new Imagick();
$imagick->readImage("/path/to/file.mp4[60]");
$imagick->setImageFormat('jpg');
$imagick->scaleImage(400,0);
$imagick = $imagick->flattenImages();
$save = $imagick->writeImage("/save/here/image.jpg");
When I was running this on a Server with PHP 5.6, this worked no problem. PDFs (with [0] instead of [60]), MP4s, M4Vs, AVIs, JPGs and PNGs worked with the code above. No problem.

But after I moved my code from a dev server to the live server (this is what I get for having environments that are out of sync!), I started getting this error:

Code: Select all

unable to open image '/tmp/magick-1FmHq1zi.pam': No such file or directory @ error/blob.c/OpenBlob/2641
Further debugging reveals that "readImage" is the problem. If that function is passed a path to a video file, it will error out.

The first thing I thought was "permissions" - but the permissions for /tmp are 777.

Everything I have read concerning this error has to do with permissions, or the "convert" command - but as this is run through PHP, I am not sure what exactly goes on between PHP and Imagemagick.

Here are current versions for both.

Image
Image
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: [PHP] error/blob.c/OpenBlob/2641

Post by snibgo »

You are reading one frame of a video file. IM delegates that to ffmpeg. Is ffmpeg on the system path of your live server? And how about your dev server?

If that's the problem and you can't muck about with system paths, then putting the full path to ffmpeg in delegates.xml might fix the problem.
snibgo's IM pages: im.snibgo.com
embers
Posts: 4
Joined: 2017-07-18T17:12:55-07:00
Authentication code: 1151

Re: [PHP] error/blob.c/OpenBlob/2641

Post by embers »

snibgo wrote: 2017-07-18T17:57:31-07:00 You are reading one frame of a video file. IM delegates that to ffmpeg. Is ffmpeg on the system path of your live server? And how about your dev server?

If that's the problem and you can't muck about with system paths, then putting the full path to ffmpeg in delegates.xml might fix the problem.
Wellllllll dang. I installed FFMpeg and that worked like a charm!

I didn't see FFMpeg as a dependency for Imagemagick anywhere! I also know for certain it wasn't on the system that was running PHP 5.6 - so is this something that changed in the past year?

Anyways, thank you from the bottom of my heart!
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: [PHP] error/blob.c/OpenBlob/2641

Post by snibgo »

Pleasure.

Maybe your other system used a different program as delegate to extract frames from videos.

ffmpeg isn't strictly a dependency. If it isn't there and ImageMagick wants to use it, IM issues a "delegate failed" message. But this can get lost in the IMagick and PHP stack.
snibgo's IM pages: im.snibgo.com
embers
Posts: 4
Joined: 2017-07-18T17:12:55-07:00
Authentication code: 1151

Re: [PHP] error/blob.c/OpenBlob/2641

Post by embers »

Maybe your other system used a different program as delegate to extract frames from videos.
I'm guessing that was the case - is there a way to find that out? In the future this is probably something I need to know! :D
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: [PHP] error/blob.c/OpenBlob/2641

Post by snibgo »

"-verbose" generally tells you about delegate action, for example (at the command line):

Code: Select all

convert -verbose PolyA.avi[0] x.png

Code: Select all

"ffmpeg.exe" -nostdin -v -1 -i "C:/Users/Alan/AppData/Local/Temp/magick-2472P75JZ0dTfwXs" -vframes 1 -vcodec pam -an -f rawvideo -y "C:/Users/Alan/AppData/Local/Temp/magick-2472KeSEOnUq0QGJ.pam"

C:/Users/Alan/AppData/Local/Temp/magick-2472KeSEOnUq0QGJ.pam PAM 200x150 200x150+0+0 8-bit TrueColor sRGB 90.1KB 0.000u 0:00.000

PolyA.avi[0]=>C:/Users/Alan/AppData/Local/Temp/magick-2472KeSEOnUq0QGJ.pam PAM 200x150 200x150+0+0 8-bit TrueColor sRGB 90.1KB 0.000u 0:00.000

PolyA.avi[0]=>x.png PAM 200x150 200x150+0+0 8-bit sRGB 25.9KB 0.016u 0:00.015
Delegates are controlled by a text file, delegates.xml, in the same directory as "convert" etc.
snibgo's IM pages: im.snibgo.com
embers
Posts: 4
Joined: 2017-07-18T17:12:55-07:00
Authentication code: 1151

Re: [PHP] error/blob.c/OpenBlob/2641

Post by embers »

Thanks again! That all helped a lot.
Post Reply