Blogger resizeImage and sourceSet Syntax
Operator | Meaning | Syntax |
---|---|---|
resizeImage |
Resize an images | resizeImage(imageURL, newSize, "Ratio") |
sourceSet |
Create responsive images | sourceSet(imageURL, [array newSize], "Ratio") |
Supported imageURL:
URLs for images hosted by Google through Blogger , Picasa , GooglePhotos, and thumbnails of YouTube can be used with these parameters.
Blogger Operator [resizeImage]
- imageURL can be from blogger expression or Image URL listed on supported image url above. If used with Image URL as value, it must be wrapped with Double Quote'
- newSize is the new size based on width
- "Ratio" wrapped with double quote. Is the integer ratio of the image "1:1" or "4:3" or "16:9" or "1200:630", etc. If this ratio is present, the image will be cropped. The right hand ratio cannot be higher than the left hand such as "320:640".
Blogger Operator [resizeImage] Example
With Expression
<img expr:src='resizeImage(data:post.featuredImage, 128, "1:1")'/>
With Image URL
<img expr:src='resizeImage("https://blogger.googleusercontent.com/img/proxy/AVvXsEhcEwTId4SnABOx7X60UUvSuolcxIKNjcK851hauI7i0JImsSeioTrPJ9Aou5NRDY7v7JKxRxCK_o2o6EQgcDP1YIdxR90rhJH0pEE3JF0v3rFRCnVo3-PeHpjeCPuXk3193yPf3tCQ-w=", 640, "640:240")'/>
Blogger Operator [sourceSet]
sourceSet is operator used in srcset attribute, is HTML attribute which allows us to tell the Browser to specify different kind of images for different screen-sizes or orientation or display-types based on different condition.<img> tag can't work alone with srcset attribute. we still need the src attribute. In short, we have two attribute in single <img> tag, src and srcset.
The operator sourceSet syntax almost like the operator resizeImage, the different is on the newSize part. In this part we set multiple image width dimension separated by comma.
Example with expression
<img expr:src='data:post.featuredImage' expr:srcset='sourceSet(data:post.featuredImage, [256,512,945,1684])'/>
Example with Image URL
<img src='https://blogger.googleusercontent.com/img/proxy/AVvXsEhcEwTId4SnABOx7X60UUvSuolcxIKNjcK851hauI7i0JImsSeioTrPJ9Aou5NRDY7v7JKxRxCK_o2o6EQgcDP1YIdxR90rhJH0pEE3JF0v3rFRCnVo3-PeHpjeCPuXk3193yPf3tCQ-w=' expr:srcset='sourceSet("https://blogger.googleusercontent.com/img/proxy/AVvXsEhcEwTId4SnABOx7X60UUvSuolcxIKNjcK851hauI7i0JImsSeioTrPJ9Aou5NRDY7v7JKxRxCK_o2o6EQgcDP1YIdxR90rhJH0pEE3JF0v3rFRCnVo3-PeHpjeCPuXk3193yPf3tCQ-w=", [256, 512, 945, 1684])'/>