How to delete derived resources?

Follow

Comments

8 comments

  • Avatar
    Julien Bornstein

    Does delete_all_resources() can be used with a tag filter (delete_all_resources_by_tag() ?)

    0
    Comment actions Permalink
  • Avatar
    Itay Taragano

    Deleting all resources sharing a certain tag can be performed with the  delete_resources_by_tag Admin API method, e.g., in PHP:

    $api->delete_resources_by_tag("mytag");

    For more information:

    http://cloudinary.com/documentation/admin_api#delete_resources_by_tags

    Note that each call deleted up to 1000 resources.

    0
    Comment actions Permalink
  • Avatar
    Forrest Maready

    I deleted the resource (containing an incorrect image) before I realized that it wouldn't automatically delete the derived images. Is there any way to delete the derived resources of that now deleted resource? I deleted and recreated the resource, assuming all derived resources would be deleted. Obviously, it doesn't list the derived resources under the new resource, though the URLs are still live and showing an incorrect image.

    It seems like I now have no way to delete those "orphaned" resources.

     

    Thanks

    0
    Comment actions Permalink
  • Avatar
    Itay Taragano

    Hi Forrest.

    Indeed deleting an image also deletes all its derivatives as well. However, note that both the original and the derived images might be still cached in the CDN.

    For more information:

    http://support.cloudinary.com/entries/23310776-I-have-deleted-an-image-and-though-it-has-been-removed-from-the-media-library-it-is-still-available-

    If you want the purge the CDN as well, you should set the  invalidate  parameter to  true  while deleting, for example in Rails:

    Cloudinary::Uploader.destroy('my_image', :invalidate => true)

    Deleting via the Media library automatically invalidates the image. Note that it may take up to an hour for the invalidation to fully propagate through the CDN.

    0
    Comment actions Permalink
  • Avatar
    Forrest Maready

    Thank you Itay-

    Does the API call purge the CDN any faster than doing it through the Media Library?

     

    Many thanks

    0
    Comment actions Permalink
  • Avatar
    Itay Taragano

    Invalidating either through the Admin API or the Media library may both take up to an hour. Note that this requests to propagate through Akamai's entire CDN network (100K+ servers in less than 1 hour).

    We warmly recommend to include the version component as part of the URL. Cloudinary's 'version' is a simple "cache busting" solution that acts as a unique name for each uploaded image. Unlike invalidation, 'versions' instantly bypasses all cached versions and force the delivery of the latest version of the image.

    For more information:

    http://support.cloudinary.com/entries/23663103-What-are-image-versions-

    0
    Comment actions Permalink
  • Avatar
    aster

    Hi I have already set invalidate to "yes" under advanced settings. However, I am still getting the cache of the previous photo when i upload a new image with the same image name. I do not wish to keep track the version in the url and I would like to get the latest image just with the same URL. Could you help me with this? By the way I am using .Net.
    Thank you very much.

    [UPDATE] 
    I managed to resolve this issue by storing the version as I realized that no matter what version I provide in the URL e.g. "/v1" or "/v1486331234", it will return the latest image. Thanks

    0
    Comment actions Permalink
  • Avatar
    Nadav Ofir

    Hi Aster,

    By default URLs that contain version components aren't invalidated.
    More information about the default invalidation policy is available here: https://support.cloudinary.com/hc/en-us/articles/209048985-Why-wasn-t-my-URL-properly-invalidated-

    If you're still encountering issues, please open a support ticket so we can look deeper into your use case.

    0
    Comment actions Permalink

Please sign in to leave a comment.