Jump to content

file_exists doesn't work for images on url


preetham

Recommended Posts

Thanks.

 

This seems to be working fine.

 

However, i see some performance issue, I mean , it takes 3 secs more time now.

 

Is it because of this or something else?

You can store the files on your server temporarily and then use getimagesize.

Link to comment
Share on other sites

First, Don't use getimagesize() for this, it downloads the whole image. Use cURL, which can ask the remote server for only the HTTP headers, which will return status=200 or status=404, etc.

 

Second: ofcourse there is a performance issue if you are going to verify each image every time, which is why you would cache the results in a file somewhere.

Link to comment
Share on other sites

You can store the files on your server temporarily and then use getimagesize.

 

for storing it on my server, i can use file_exists itself. 

I'm having issue for remote images.

 

 

First, Don't use getimagesize() for this, it downloads the whole image. Use cURL, which can ask the remote server for only the HTTP headers, which will return status=200 or status=404, etc.

 

Second: ofcourse there is a performance issue if you are going to verify each image every time, which is why you would cache the results in a file somewhere.

Thanks for the advice,

 

I will check on this asap.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.