Actually, the crop XML doesn't tell you how big the image is - but since you're probably the one that set it up in the beginning, you are able to find the right values for the specific crops;
I've been using something quite elaborate for this which might be overkill for your needs, but you could try to use the same technique (creating an XML config file with the cropping setup) - take a look here on GitHub - it's not "plug and play" yet, but if you want to give it a go, I'll help you to a usable file.
Sorry, I never noticed your reply — cchehn is right, you can actually calculate the values from the crop data, though it doesn't even need to look quite as daunting:
@Chriztian is right I posted that before I refactored but left it because I figured it would be helpful for anyone who was trying to navigate the image crop XML to have the whole thing spelled out in the current syntax. Most of the examples I came across were pretty old.
Get Image Crop width and height into Xslt
Hi...
Using the Image Crop function, im trying to display a cropped image via the media picker.
My xslt works fine but since the right way to display an image is to set width and height i've run into question.
Can I somehow get the width and height value from the cropped image instead of typing the value in myself?:
Cheers...
/Crawn
Hi Crawn
As I recall the dimensions of the cropped media are not available in the XML.
</Image>
Hi Crawn,
Actually, the crop XML doesn't tell you how big the image is - but since you're probably the one that set it up in the beginning, you are able to find the right values for the specific crops;
I've been using something quite elaborate for this which might be overkill for your needs, but you could try to use the same technique (creating an XML config file with the cropping setup) - take a look here on GitHub - it's not "plug and play" yet, but if you want to give it a go, I'll help you to a usable file.
/Chriztian
Hi
@Sebastian: Nope, looks like you're right ;)
@Chriztian: Hmmm I have no idea of what your trying to tell me :/
@Crawn
Its pretty easy math all the pieces are there for each crop.
Hi Crawn,
Sorry, I never noticed your reply — cchehn is right, you can actually calculate the values from the crop data, though it doesn't even need to look quite as daunting:
/Chriztian
@Chriztian is right I posted that before I refactored but left it because I figured it would be helpful for anyone who was trying to navigate the image crop XML to have the whole thing spelled out in the current syntax. Most of the examples I came across were pretty old.
-C.
is working on a reply...