Added script to reduce original image size to fit in page layout
This commit is contained in:
parent
194d7cdb81
commit
98b71db1f4
1 changed files with 14 additions and 1 deletions
|
@ -9,6 +9,19 @@ ${scripts.add("/js/imageUpload/cropImage.js")}
|
|||
${stylesheets.addFromTheme("/uploadImages.css")}
|
||||
${stylesheets.addFromTheme("/jquery.Jcrop.css")}
|
||||
|
||||
|
||||
<#--Reduce original image to fit in the page layout
|
||||
If the width of the image is bigger or equal to 500 pixels,
|
||||
the script below will reduce the width to 500 pixels and
|
||||
the height will be in proportion to the new height-->
|
||||
|
||||
<#macro newImageSize>
|
||||
<#if (imageWidth >= 500)>
|
||||
width="500" height="${(500*imageHeight)/imageWidth}"
|
||||
</#if>
|
||||
</#macro>
|
||||
|
||||
|
||||
<div id="photoCroppingContainer">
|
||||
<h2>Photo Upload</h2>
|
||||
<!-- This is the image we're attaching Jcrop to -->
|
||||
|
@ -33,7 +46,7 @@ ${stylesheets.addFromTheme("/jquery.Jcrop.css")}
|
|||
</div>
|
||||
<div id="photoCropping">
|
||||
|
||||
<img style="border:1px solid green;" src="${imageUrl}" id="cropbox" />
|
||||
<img style="border:1px solid green;" src="${imageUrl}" <@newImageSize/> id="cropbox" />
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue