Adding attributes to images added to image field in form
FYI if you add an image URL to an "Image Field" in a form ZC automatically creates the "<img src=...../> html around it...
This can be both convenient and a nuisance in some situations because it blocks you from quickly adding CSS/HTML attributes...
Use a function like this to remedy this inconvenience...
string translate.edit_img(string url, string attributes)
{
first_part = (input.url).subString(0,5);
second_part = input.attributes;
third_part = " " + (input.url).subString(5);
return first_part + second_part + third_part;
}
inputs.......
string url = image field
string attributes = well, string attributes!
Example:
</html>
<head>
<style type="text/css">
img.double-border
{
border:1px solid #ccc; padding:2px; background:#eee;
}
</style>
</head>
<body>
<div id="image">
string translate.edit_img(input.image, "class='double-border' ")
</div>
</body>
</html>