Displaying a small image of an attachment.

  • 0
  • 1
  • Question
  • Updated 2 months ago
  • Answered
I have a File Attachment field named Picture 1 which is used to attach pictures of the equipment being serviced. 

Right next to the attachment field, I want to display a small image of the picture.  This works OK, except if when a revised image is added to the Picture 1 field, the formula field be still shows the original picture.  I thought the v0 parameter would make sure to show the current version of the attachment.

Formula field that displays a small image of the attachment field:
If([Picture 1]>"","<img src=" & URLRoot() & "up/" & Dbid () & "/a/r" 
& [Record ID#] & "/e183/v0\" height='200';>","")
Photo of JimLieder

JimLieder

  • 344 Points 250 badge 2x thumb

Posted 4 months ago

  • 0
  • 1
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 60,108 Points 50k badge 2x thumb
This has to do with your computer cacheing images to improve performance in loading web pages, , but I don’t recall offhand where that obscure setting is, and it would depend on your browser. You will need to google like chrome image cacheing disable
Photo of Dean

Dean

  • 636 Points 500 badge 2x thumb
I created a formula URL but instead of showing the thumbnail picture, it show the link code...



http://<img src=https://fixandpaint.quickbase.com/up/bkkhbuvmj/a/r76/e36/v0" height='200';>


The actual formula is:

If([Picture]>"","<img src=" & URLRoot() & "up/" & Dbid () & "/a/r" 
& [Record ID#] & "/e36/v0\" height='200';>","")

where the image field name is Picture and the fid is 36.

Can you help with what I am doing wrong?
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 60,108 Points 50k badge 2x thumb
Try changing the field to a formula Rich Text type if it is still a formula text field type.
Photo of Dean

Dean

  • 636 Points 500 badge 2x thumb
Thanks for the suggestion, the field was a formula url referencng an attachment field... I changed to be a formula Rich Text but it does not show the attachment as a thumbnail.

The attachment field has the "Show .jpg, .png and .gif files as images in forms"  checked.

Any other thoughts??? 
Photo of Dean

Dean

  • 636 Points 500 badge 2x thumb
Got it... I removed the "If([Picture]" and it is working perfectly... thanks for the rich text suggestion.  For reference for others that might stumble upon this... the final definition that works is:

Have your file attachment field.
create a new formula Rich Text field.
define the formula for new field:

"<a href=\""  & URLRoot() & "/up/"& Dbid () & "/a/r"& 
[Record ID#] &"/e36/v0\" /> "&
 "<img src=\""  & URLRoot() & "/up/"& Dbid () &"/a/r"& 
[Record ID#] &"/e36/v0\" height=\"200\"alt='' />" & "</a>"

Where the 36 in e36 is the fid of the file attachment field.
(Edited)
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 60,108 Points 50k badge 2x thumb
Your solution is working but only if there is an image. If there is no image then rather than displaying a nice clean blank space it will have sort of a broken picture image.

The solution is to reinstate your IF

But like this

IF(totext([file attachment field])<>"",

Then everything else

Then close the )
Photo of Dean

Dean

  • 636 Points 500 badge 2x thumb
Thanks, that worked great.