Imagick PHP - image properties
I'm using imagick for PHP (not command line).
I have a page that outputs a bunch of images, and each gets resized with imagick.
The image resizing is done using the usual trick of using another PHP file with the imagick script in, the img url is the other file and has GET data as location to the image folder.
Like so:
<?php
//in gallery.php
echo '<img src="incs/image_rotate.php?folder='.$folder.'">';
//in image_rotate.php imagick outputs in the usual way:
header( "Content-Type: image/png" );
echo $canvas;
?>
It all works fine, but when I right click on the image and select properties it outputs the image details as the php file, folder and paths from the GET info it received.
Like this:
http://domainname.com/incs/image_rotate.php?folder=/piccies/folder1/
When what I want is the original filename. At least a specified filename, or as I have seen on other sites, the image properties are simply the imagick script filename, without any GET.
Like so:
http://domainname.com/incs/image_rotate.php
Any ideas?
Cheers
pr0gr4mm3r posted this at 20:24 — 7th March 2009.
He has: 1,502 posts
Joined: Sep 2006
If you are calling a dynamic image like this:
<img src="path/to/image.php?query=string" />
...it will show up in the image properties with that exact path, because that is where the image is being fetched from. There is no way around that, unless you use mod_rewrite.
greg posted this at 22:28 — 7th March 2009.
He has: 1,581 posts
Joined: Nov 2005
Bummer.
Thanks anyway.
Don't suppose there's a way to pass a variable to the script any way other than GET?
(I just know there's a big fat "no" coming up...)
pr0gr4mm3r posted this at 23:17 — 7th March 2009.
He has: 1,502 posts
Joined: Sep 2006
NO.
...But you can alter it and make it look pretty using mod_rewrite. Or even something like...
http://domainname.com/incs/image_rotate.php/piccies/folder1/
...would work.
greg posted this at 10:14 — 8th March 2009.
He has: 1,581 posts
Joined: Nov 2005
I'll have a tinker with mod_rewrite.
From what I have seen and used with Imagick, it has some amazing functions and options. Often I find it can do something that is truly mind blowing, and therefore I'm still not convinced there's no way to alter the outputted image properties within the script file...
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.