Upload.asp
gets called everytime someone uploads somthing into an input template. For a single image upload we can do the following inside the input.asp:
<tr>
<td>Image</td>
<td>
<span name="pic_span" id="pic_span">
<% if content.item("image_name") <> "" then %>
<img src="<%= content.item("image_name") %>" />
<% end if %>
</span>
<% input.setParam "span_label", "pic_span" %>
<% input.setParam "show_browse", "link" %>
<% input.setParam "show_upload", "attatch" %>
<% input.showAcquireImage "image_name", content.item("image_name") %>
</td>
</tr>
If there are multiple images change the above so that all content.items becomes the list object. When createing the list use the image_name as the iterator.
Then in the upload.asp:
if content.item("_cmsUploadVariable") = "upload#lg_image" then
value = content.item("_cmsUploadValue")
'resize original image to 309px x 230px
lg_res = image.thumbnail(value, "", 309, 230)
if lg_res = "" then
content.add "_cmsError", image.errorMsg
exit Sub
end if
'save resized large image
content.add content.item("_cmsUploadValue"), lg_res
' resize original image to 169px x 120px
md_res = image.thumbnail(value, "_med", 169, 120)
if md_res = "" then
content.add "_cmsError", image.errorMsg
exit Sub
end if
'save resized medium image
content.add "upload#md_image", md_res
'resize original image to 94px x 70px
sm_res = image.thumbnail(value, "_thumb", 94, 70)
if sm_res = "" then
content.add "_cmsError", image.errorMsg
exit Sub
end if
content.add "upload#sm_image", sm_res
end if
Comments