Get images sizes

Comments

4 comments

  • Avatar
    Daniel Mendoza

    Hi,

    The Admin API can be used to query a particular resource and it will return the width and height of that resource: https://cloudinary.com/documentation/admin_api#details_of_a_single_resource

    Note that the Admin API is rate limited, and more details can be found here based on your plan: https://cloudinary.com/documentation/admin_api#usage_limits

    It might be beneficial to store the width and height with the public_id in case the Admin API limits are exceeded. The width and the height are returned in the upload response of a resource. Can you provide more details on why the image may not be needed?

    Hope this helps!

    1
    Comment actions Permalink
  • Avatar
    Dmitrii

    Thank you for the answer.

    Here is a good explanation of the reason https://stackoverflow.com/questions/50323461/image-dimensions-metadata-on-google-cloud-storage 

    Also, I use Photoswipe - http://photoswipe.com/documentation/getting-started.html for full image preview. To generate a gallery it requires the image sizes. This preview may be never opened by the particular user.

    Also, placeholders for the images, do not use them in my project but it is definitely the reason.

    In a PHP time that was simple, I try to build a serverless app now and the getting of all images from a folder and the sizes of images are surprisingly tough with a cloud or CDN. I've checked three of them.

    To avoid login every user as an admin to Coudinary I see only the way is to keep sizes in a database

    0
    Comment actions Permalink
  • Avatar
    Dmitrii

    By the way, I do not have a server in my app at all.

    0
    Comment actions Permalink
  • Avatar
    Dmitrii

    So, this is the solution that works for me finally https://github.com/image-size/image-size 

    0
    Comment actions Permalink

Please sign in to leave a comment.