Imagick 'delegate failed'

SheppardDigital
SheppardDigital used Ask the Experts™
on
Hi all,

We have a web based application that creates a JPG thumbnail from a PDF, this worked perfectly until one day it just stopped. We asked our hosting company to update everything, they did and it doesn't resolve the problem.

Anyone any ideas?
<b>Fatal error</b>:  Uncaught exception 'ImagickException' with message 'unable to open image `/tmp/phpqGkf3P': No such file or directory' in /var/www/vhosts/assetbag.com/subdomains/church/httpdocs/modules/dam_asset_load.php:438
SWF DEBUG: Stack trace:
SWF DEBUG: #0 /var/www/vhosts/assetbag.com/subdomains/church/httpdocs/modules/dam_asset_load.php(438): Imagick-&gt;__construct('/tmp/phpqGkf3P')
SWF DEBUG: #1 /var/www/vhosts/assetbag.com/subdomains/church/httpdocs/includes/data_screen.php(799): extra_processing(Array, Array, 'insert into dam...', 10515)
SWF DEBUG: #2 /var/www/vhosts/assetbag.com/subdomains/church/httpdocs/modules/dam_asset_load.php(262): require('/var/www/vhosts...')
SWF DEBUG: #3 /var/www/vhosts/assetbag.com/subdomains/church/httpdocs/includes/body.php(63): require('/var/www/vhosts...')
SWF DEBUG: #4 /var/www/vhosts/assetbag.com/subdomains/church/httpdocs/index.php(155): require('/var/www/vhosts...')
SWF DEBUG: #5 {main}

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
I think you should not worry about what when wrong but try to find a way around it so lets try. Did you do a file exist call just before you tried to load it? Try giving the full path instead of relative.

Author

Commented:
Hi,

I've used the following code in the page to determine if the file exists, and it confirming it does.

if(file_exists($_FILES['Filedata']['tmp_name'])) {
echo "FILE EXISTS";
} else {
echo "FILE DOES NOT EXIST";
}

Open in new window

can you post the code that you load the file with?
HTML5 and CSS3 Fundamentals

Build a website from the ground up by first learning the fundamentals of HTML5 and CSS3, the two popular programming languages used to present content online. HTML deals with fonts, colors, graphics, and hyperlinks, while CSS describes how HTML elements are to be displayed.

Author

Commented:
Hi, here's a snippet of the code from the page
$new_img = new Imagick($_FILES['Filedata']['tmp_name']);		
$thumb_img = $new_img->clone();
 
$width = $new_img->getImageWidth();
$height = $new_img->getImageHeight();
				 
//calculate the image ratio
$imgratio = $width / $height;
if ($imgratio > 1) {
	$newwidth = $ThumbWidth;
	$newheight = $ThumbWidth/$imgratio;
	} else {
	$newheight = $ThumbWidth;
	$newwidth = $ThumbWidth*$imgratio;
	}
	
//function for resize image.
$thumb_img->thumbnailImage($newwidth,$newheight);
	
// change format to jpeg
$thumb_img->setImageColorspace(Imagick::COLORSPACE_SRGB);
$thumb_img->setImageFormat("jpeg");
$thumb_img->writeImage( "dam_images/thumb" . $last_id . ".jpg" );	

Open in new window

OK but I want to see what comes just before the first line of code in the snippet.

Author

Commented:
Just before it is this...
// Load image
if ($_FILES['Filedata']['size'] > 0) {
	$isMovie = false;
	if (str_replace(" ","_",$ext) == 'mpg' OR str_replace(" ","_",$ext) == 'mpeg' OR str_replace(" ","_",$ext) == 'mov' OR str_replace(" ","_",$ext) == 'avi' OR str_replace(" ","_",$ext) == 'wmv') {
	$isMovie = true;
	}
				
	$isDocument = false;
	if (str_replace(" ","_",$ext) == 'ppt' OR str_replace(" ","_",$ext) == 'pptx') {
		$isDocument = true;
		}
	
	// Compressed files or anything that doesn't need resizing i.e. swf
	$isCompressed = false;
	if (str_replace(" ","_",$ext) == 'zip' OR str_replace(" ","_",$ext) == 'rar' OR str_replace(" ","_",$ext) == 'swf') {
		$isCompressed = true;
		}
					
	if ($isMovie == false && $isDocument == false && $isCompressed == false) {
				
		if(file_exists($_FILES['Filedata']['tmp_name'])) {
			echo "FILE EXISTS";
			} else {
			echo "FILE DOES NOT EXIST";
			}

Open in new window

check out this site I found http://pecl.php.net/bugs/bug.php?id=12612&edit=1
From what I gather there is nothing wrong with your code, but the problem could be with the lib not working, there are lots of other people having the same problem maybe you could downgrade or upgrade to see if it fixes the problem.
But like I said nothing wrong with your code.

Author

Commented:
Thanks, I'll contact the hosting company.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial