Photo Not Displaying in Record (form)

  • 1
  • 3
  • Question
  • Updated 2 years ago
  • Answered
I am uploading a single photo to a form (record) as a file attachment.  I have chosen to option to display the image (.jpg, .png) on the form, but it is not displaying.  It is showing the file name which is clickable to view the photo.  I would like the photo to display on the page though so the employee's picture shows with the rest of his record.  Help!
Photo of Aaron Zielinski

Aaron Zielinski

  • 272 Points 250 badge 2x thumb

Posted 2 years ago

  • 1
  • 3
Photo of Matthew Neil

Matthew Neil

  • 31,438 Points 20k badge 2x thumb
Create a new field, Formula-Text, and call it something like "Image"

Insert this formula with a few modifications:

If([Picture File]="","","<img height=\"80\" src=\"" & URLRoot() & "up/" & Dbid () & "/a/r" & [Record ID#] & "/e41/v0\" />")

The changes you will need to make are the "e41", change that to the field id of your file attachment field...
"eXX"
I put a conditional If statement to make it blank if the file is empty, so change the field [Picture File] to your file attachment field.
You can also control the size/height of the image

Let us know if you get stuck.
(Edited)
Photo of Aaron Zielinski

Aaron Zielinski

  • 272 Points 250 badge 2x thumb
Thanks Matthew.  Based upon John's response, it appears that it's there but only displaying in "view" mode vice "edit" mode.  I'm hoping to see it regardless of mode since we mostly work in "edit" mode.
Photo of Matthew Neil

Matthew Neil

  • 31,438 Points 20k badge 2x thumb
This method is one field and works in edit, view and reports.  

I'd recommend not sizing the image for height & width, as this could distort your original.

Make sure the "Enable HTML" checkbox just above the formula entry box is checked to display the image.

"<img height=\"80\" src=\"" & URLRoot() & "up/" & Dbid () & "/a/r" & [Record ID#] & "/e41/v0\" />"
Photo of Aaron Zielinski

Aaron Zielinski

  • 272 Points 250 badge 2x thumb
Thanks!
Photo of Johnny QuickBase

Johnny QuickBase

  • 300 Points 250 badge 2x thumb
Are you viewing or editing the record?  A link will display in edit, and the picture should show when viewing.
Photo of Aaron Zielinski

Aaron Zielinski

  • 272 Points 250 badge 2x thumb
Now that you mention it, I was viewing it in "edit".  I see the picture in "viewing".  Is there a way to view the picture in "edit" as that's where we do most of our actual work?  Thanks!
The method shown below will show the picture in edit or view mode..
Neil
You can do this with two formula fields:
First create a formula text field with with this formula: 
"https://www.quickbase.com/up/";   & Dbid () 
  & "/a/r" 
  & [Record ID#] 
  & "/e6/v0?"
  & [employee image]

[employee image] is the file attachment field
Replace https://www.quickbase.com  with your domain name.
The 6 in e6 is the fid of the file attachment field

Then to display the image - create a second field 
This is also a formula text field with the allow some html box checked
"<img src=\""         
         &[image href]
         & " height=\"75\""
         & " width=\"75\""
         & "\"/>"

Where [image ref] is the first formula field
Good luck
Neil
(Edited)
Photo of Aaron Zielinski

Aaron Zielinski

  • 272 Points 250 badge 2x thumb
Thanks Neil.  Based upon John's response, it appears that it's there but only displaying in "view" mode vice "edit" mode.  I'm hoping to see it regardless of mode since we mostly work in "edit" mode.
I think our messages crossed.  The method above works in both modes.  I just tested it on our system.
Neil
Photo of Aaron Zielinski

Aaron Zielinski

  • 272 Points 250 badge 2x thumb
I think I'm messing up somewhere.  The first formula is showing up on the edit page and a generic thumbnail directly below it.  A few questions:

1.  Do I need to take out or leave in the spaces in the second formula (the ones going from line to line)?
2. The "6" in the second formula.  Is that the # of the Form Element of the first text formula we created?

Here is a snapshot below that is showing up:




Thanks for you patience!
You want to display the second formula field - the first one is just a link to the file attachment field.  The 6 is the field id of the file attachment field.  On our system 6 is the field id of the field labeled  [employee image]. 
If you paste your two formula fields in your response I'll check them for syntax.
Neil