Need testers! Imagick windows build.
Posted: 2007-10-03T12:02:45-07:00
Use https://github.com/ImageMagick/ImageMagick/discussions instead.
https://imagemagick.com/discourse-server/
https://imagemagick.com/discourse-server/viewtopic.php?t=9835
Code: Select all
Fatal error: Uncaught exception 'ImagickException' with message 'Not a JPEG file: starts with 0x00 0x00 `G:\Scripts\TN0711I24N3572.jpg'' in G:\inetpub\wwwroot\admin\test2.php:8 Stack trace: #0 G:\inetpub\wwwroot\admin\test2.php(8): Imagick->readimage('G:/scripts/TN07...') #1 {main} thrown in G:\inetpub\wwwroot\admin\test2.php on line 8
Code: Select all
$im = new Imagick();
try
{
$im->readImage( "broken.jpg" );
} catch ( ImagickException $e ) {
echo "Caught exception: " . $e->getMessage() . "<br />\n";
}
Thanks Mikko - that'll certainly get around the problem I have now. Much appreciated.mkoppanen wrote:You need to try catch the exception thrown.
Try this:
Code: Select all
$im = new Imagick(); try { $im->readImage( "broken.jpg" ); } catch ( ImagickException $e ) { echo "Caught exception: " . $e->getMessage() . "<br />\n"; }
Code: Select all
/* Can not pass image name to constructor since
if exceptions are not used it is not possible to catch
error in construction */
$im = new Imagick();
if ( $im->readImage( "foo.png" ) === FALSE )
{
/* Do something with the error */
}
if ( $im->thumbnailImage( 200, null ) === FALSE )
{
/* Do something with the error */
}
if ( $im->writeImage( "th_foo.png" ) === FALSE )
{
/* Do something with the error */
}
Code: Select all
try
{
$im = new Imagick( "foo.png" );
$im->thumbnailImage( 200, null );
$im->writeImage( "th_foo.png" )
}
catch ( ImagickException $e )
{
echo $e->getMessage();
die();
}