php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57952 Fatal error: Uncaught exception 'ImagickException' with message 'Unable to read
Submitted: 2007-12-04 22:37 UTC Modified: 2010-02-28 07:10 UTC
Votes:6
Avg. Score:3.8 ± 1.2
Reproduced:3 of 3 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: susan dot wu at maesinfo dot com Assigned:
Status: No Feedback Package: imagick (PECL)
PHP Version: 5.2.1 OS: Reahat
Private report: No CVE-ID: None
 [2007-12-04 22:37 UTC] susan dot wu at maesinfo dot com
Description:
------------
I comple ImageMagick 6.3.6 , PHP 5.2.4 , and Apache/2.2.6, and Imagick 2.1.0-rc1 , and then I copy a real image to /tmp/test.jpg and then  run command php thumbnail.php which from examles , It got :
Fatal error: Uncaught exception 'ImagickException' with message 'Unable to read the file: /tmp/test.png' in /var/www/htdocs/thumbnail.php:11
Stack trace:
#0 /var/www/htdocs/thumbnail.php(11): Imagick->readimage('/tmp/test.png')
#1 {main}
  thrown in /var/www/htdocs/thumbnail.php on line 11

can you help ? what's the problem?

Reproduce code:
---------------
<?php
 
/*
	A simple example demonstrate thumbnail creation.
*/ 
 
/* Create the Imagick object */
$im = new Imagick();
 
/* Read the image file */
$im->readImage( '/tmp/test.png' );
 
/* Thumbnail the image ( width 100, preserve dimensions ) */
$im->thumbnailImage( 100, null );
 
/* Write the thumbail to disk */
$im->writeImage( '/tmp/th_test.png' );
 
/* Free resources associated to the Imagick object */
$im->destroy();
 
?

Expected result:
----------------
excutable

Actual result:
--------------
Fatal error: Uncaught exception 'ImagickException' with message 'Unable to read the file: /tmp/test.png' in /var/www/htdocs/thumbnail.php:11
Stack trace:
#0 /var/www/htdocs/thumbnail.php(11): Imagick->readimage('/tmp/test.png')
#1 {main}
  thrown in /var/www/htdocs/thumbnail.php on line 11


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-12-09 10:05 UTC] pascal dot duersteler at gmail dot com
by your leave, but:

You talk about a jpg in the description but in the code is a path to a jpg, this would also match to the error message.

Just an idea...
 [2007-12-09 10:06 UTC] pascal dot duersteler at gmail dot com
Sorry, should be "in the code is a path to a
png" not "..to a jpg"
 [2007-12-09 12:08 UTC] mkoppanen@php.net
Do you see PNG in the list of supported formats in phpinfo() ?
Are you sure the use running PHP has access to the image?
 [2007-12-09 20:29 UTC] susan dot wu at maesinfo dot com
Thank all  , I resolved it by compiled version 2.1.0, It's has no problem.
 [2007-12-10 05:48 UTC] mkoppanen@php.net
Im closing the bug because the issue was resolved.
 [2009-09-04 08:32 UTC] igor at stereokiller dot ru
FreeBSD 7.0 amd64 pecl-imagick-2.2.2_1

The same error with .jpg file.
I don't know how to fix it.
 [2009-09-04 08:40 UTC] mkoppanen@php.net
Is jpeg supported by you ImageMagick ?
 [2012-07-20 13:23 UTC] 280706417 at qq dot com
sorroy, I am chinese. my english is not good.I hope you can understand me .

I met the same mistake! when I use Imagick deal jpg pic,The following error occurred as "Uncaught exception 'ImagickException' with message 'Unable to read the file: /www/pic/img4/201207/1023/V9TTeSK3fbYv4Kz6Zwr6P4.jpg'"。

but it read png or gif pic is right,I don't know what the reason is。

I look phpinfo。gd support jpeg . Imagick as support jpg。

Who can help me? thanks !
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 11:01:30 2024 UTC