Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ImageMagick - "Read" something changed??

Status
Not open for further replies.

InZomnia

Programmer
Dec 29, 2005
19
0
0
Hmm, I made a script two years ago, but now it doesn't work.

It's the line:
$image->Read("./test.jpg");
...It will not read anything, instead i get a "500 Internal Server Error". If i ### that line i don't get that 500 error.
So now I can't open any files in any of my IM scripts. :(

Code:
#!/usr/bin/perl -w
print "Content-type: text/html\n\n";
use Image::Magick;

my $image = Image::Magick->new;
$image->Read("./test.jpg");
$width = $image->Get('columns');
$height = $image->Get('rows');
print "$width x $height";
undef($image);

Any ideas will help!

Thanks!!!
 
1) You should use the full path to test.jpg
2) You should check the permissions of test.jpg
3) Add some error statements
$image->Read("/path/to/file/test.jpg") || print "Can't open test.jpg:$!\n";

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[noevil]
Travis - Those who say it cannot be done are usually interrupted by someone else doing it; Give the wrong symptoms, get the wrong solutions;
 
that means the current directory
I don't think it's every really needed except in unix/linux where '.' doesn't exist as part of your path. Sometimes you have to type ./program.pl

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[noevil]
Travis - Those who say it cannot be done are usually interrupted by someone else doing it; Give the wrong symptoms, get the wrong solutions;
 
Hmm, I have tried writing paths like that earlier, but I HAD to use the ./ for perl to find the file, for some reason.

Anyway, the problem is solved. inmotionhosting re-compiled IM. So now it's working again. I guess the first place to check if something is wrong with something that used to work, is the hosting company. :)
 
And thanks alot everyone, for your input!!!!! :))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top