I've written a link aliasing script that allows users to rewrite urls
on their web pages. The crux of the script is the following:
if(getimagesize ($redirect_to) == 0)
header("Locatio n: $redirect_to");
else
include("$redir ect_to");
Which uses getimagesize() to determine if the link specified in
$redirect_to points to an image (i.e img src) in which case it should
include the image in the page, or if the link points to another
website (i.e. a href), in which case I use the header method to
redirect to that page when the link alias is called.
So far this script has been working great, but I recently had a
customer run it under php4.2.2 and the getimagesize is taking approx.
160 seconds to execute.
Can anyone think of a different way to tell if a remote file is an
image? And also, has anyone else experienced this kind of behavior
with getimagesize when running php4.2.2?
Assistance is really appreciated.
Thanks,
Esoos
on their web pages. The crux of the script is the following:
if(getimagesize ($redirect_to) == 0)
header("Locatio n: $redirect_to");
else
include("$redir ect_to");
Which uses getimagesize() to determine if the link specified in
$redirect_to points to an image (i.e img src) in which case it should
include the image in the page, or if the link points to another
website (i.e. a href), in which case I use the header method to
redirect to that page when the link alias is called.
So far this script has been working great, but I recently had a
customer run it under php4.2.2 and the getimagesize is taking approx.
160 seconds to execute.
Can anyone think of a different way to tell if a remote file is an
image? And also, has anyone else experienced this kind of behavior
with getimagesize when running php4.2.2?
Assistance is really appreciated.
Thanks,
Esoos
Comment