Hey, gusys. I am trying to add a image field on it...
# general
r
Hey, gusys. I am trying to add a image field on items page, but I found that the image size can vary depend on the image size we upload to. Is there a way to make them all fixed size when uploaded, so when we list them out, the image can be consistent across the board?
question not answered 1
d
I don't believe you can alter the size of the images when they are uploaded, however you can switch to a 'inline html' custom field for complete control over how the image(s) displays on the item page. Having said all that, the 'image' field does have a max width of 250px (NS Help: Field Type Descriptions for Custom Fields)
👍 1
r
Sounds good, but even with the inline html, will it be able to fix every picture to the same size?
d
yes, here's the default value for a custom item field (inline html) that I use (that fixes the width to 300px)
Copy code
'<a href="'||{full path to image in file cabinet}||'" target="_blank">
   <object 
      data="'||{full path to image in file cabinet}||'" 
      type="image/jpg"
      width="300px">
</a>'
so this makes the image a clickable link too. The nice thing is putting the image inside a
<object>
element means that if the image doesn't exist for some reason, it doesn't break the item page from loading or show an error
r
It actually sounds useful, but I will assume we will need to pass the link by users to the html every time when they try to upload the picture instead of simply selecting an image like how it os usually done?
👍 1