Support » Plugin: Cloudinary - Image management and manipulation in the cloud + CDN » Automatically upload and check if file exists

  • p10design

    (@p10design)


    3 quick questions:

    1.Is there a way (filter/hook) to automatically upload fles to cloudinary on file upload? (assuming the user is using the Media Library).

    2. when using cloudinary_url function, is there a way to check if the image exists on the cloud before trying to fetch it?

    3. What happens if my cloudinary account goes over the limit? Will the images still render on my website? Will it default to the original wp image? Or will I get a 404 or some other error?

    https://wordpress.org/plugins/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author cloudinary

    (@cloudinary)

    Hi Dan,

    1. Currently uploading directly to WP’s media library will store the images on your WP storage, you’ll need to migrate the images afterwards to Cloudinary (can be done in bulks).
    2. You can do a HEAD request to make sure you’re getting a 200 response before using cloudinary_url.
    3. The images will still keep on rendering on your account. You’ll get an Email notifications when you’re about to reach the limits and after you’ve exceeded them, and we’ll kindly ask you to update your plan to one which will be more suitable to your requirements.

    p10design

    (@p10design)

    1. Thanks

    2. How do I do a HEAD request?

    3. Thanks

    Plugin Author cloudinary

    (@cloudinary)

    You can do something like:

    $url = cloudinary_url("my_image.jpg");
    $context  = stream_context_create(array('http' =>array('method'=>'HEAD')));
    $fd = fopen($url, 'rb', false, $context);
    if (stream_get_meta_data($fd)["wrapper_data"][0] == "HTTP/1.0 200 OK"){
      #do stuff here
    }
    fclose($fd);
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Automatically upload and check if file exists’ is closed to new replies.