Hello,
I need a little help if it is possible to do this :
- Have a flow that check orientation of images : landscape or portrait then resize homothetic image to specific dimension for Magento webfile : 1000x1640 px for portrait, or 1640x1000 px for landscape orientation
Condition : width < height => portrait then resize height to 1640 px, and crop center width to 1000 px
or width > height => landscape then resize width to 1000 px, and crop center height to 1640 px
Sometimes have images that ratio is not compatible with output format :
image is portrait orientation but the width is too small so I cannot use the script to crop for portrait dimension, but use the landscape setting.
for example have this image 3129x6569 px
width<height so portrait, resize 6569 px to 1640, ok but the width is 804 px... so I can't have 1000x1640 px
In fact, I have to ensure that ratio width/height is superior than 60% in my case.If not, first resize the width than crop center the height.
My flow works great to determine orientation, resize and crop center, I just need help to specify condition to the connector : is there a way to have a connection with a regular expression can do it ? but I didn't know how to write this condition in regex : width/height>60%
or if it is possible to do it
Best Regards,
Christian
Regular expression to determine ratio image with conditions
Re: Regular expression to determine ratio image with conditions
You have to use Switch - Calculation in the left-hand part of the condition in which you do the math using variables, and the operator will be "Greater than" and the right-hand part is 60. The left-hand part of your condition will look something like this:
Code: Select all
[Switch.Calculation:Expression="([Image.ImageWidth] / [Image.ImageLength]) * 100"]
Re: Regular expression to determine ratio image with conditions
Thanks for prompt answer freddy !
I'm testing it and give feedback !
I'm testing it and give feedback !
Re: Regular expression to determine ratio image with conditions
Many many thanks, it works great !
Thanks for your help !
Christian
Thanks for your help !
Christian