aspect_ratio for images that aren't objects

materangai7
Shopify Partner
8 0 0

Is there any way to access the dimensions or aspect ratio of an image that's "just" stored in the files?

 

I'm trying to add the height and width to images, and doing so manually would be time consuming and hard to maintain. It's simple to do when the image is part of an object:

 

...
width="973"
height="{{ 973 | divided_by: media.aspect_ratio | ceil }}"
...

But accessing it via file_img_url doesn't seem to hold any useful information.

 

Is there any way to do this?

 

Many thanks!

Replies 2 (2)
LitExtension
Shopify Partner
3362 664 725

Hi @materangai7,

Can you explain more about it? Are you trying to add width and height like the code you send for images uploaded in Customize? Or for product images.

And please send your site and if your site is password protected, please send me the password. I will check it.

LitExtension - #1 Shopping Cart Migration Expert
If our answer is helpful then please accept as solution!
Are you looking for a solution to migrate to Shopify? Contact us for further assistance.
Try our FREE DEMO now!
materangai7
Shopify Partner
8 0 0

It's for images that have been uploaded directly to the files section, so all that's known is the name and url.