Invaid URL

Hi there…

I am using FPDF to create PDFs witch can have images inside. This images can be a file in a drive or a URL. When this url does not exist, I get several errors from FPDF (due to image functions). When image is a file in a drive, I can use file_exists. The problem is when image is a link.

I tried to use CURL to check if URL is valid, but I get this error:

Warning: curl_exec() [function.curl-exec]: Could not call the CURLOPT_HEADERFUNCTION

Is there another way to check if this URL is a valid image? Or to handle image errors, so I can define a default image?

Thanks in advance.

Regards,

Escar

[php]if(@exif_imagetype($url)!==false)
{
/* vaild and supported image /
}
else
{
/
not a vaild or nor a supported image */
}[/php]
should work, but i havn’t tested it.

http://php.net/exif_imagetype
http://php.net/operators.errorcontrol

Hi again…

Your solution worked! Thank you…

This was beginning to bother me seriously :)

Regards,

Escar

Sponsor our Newsletter | Privacy Policy | Terms of Service