Forum Discussion

JohnRomano's avatar
JohnRomano
Qrew Trainee
15 days ago
Solved

Display Thumbnail Image

I have a field to display a thumbnail image;the formula is If([Image File (jpeg)]<>"" ,"<img style='max-height:200px; max-width:200px' src='" & URLRoot() & "up/" & Dbid () & "/a/r" & [Record ID#] & "/e30/v0'/>")

The image is not showing in the Form or Report view. 

Is the formula the issue?

 

  • John, change the e30 to e21 and it should work.  The formula needs to know which field has the image attachment.

  • I'm not sure why yours is not working.

     

    here is one that I use which will defat coaching if you change the name of the image file by uploading a new file attachment. 

    <img src=" & URLRoot() & "up/" & Dbid()
    & "/g/r" & QB32Encode([Record ID#])
    & "/e" & QB32Encode(12) // 12 is the fid of the file attachment field
    & "/va/" & URLEncode([Picture]) // my file field is called [picture]
    & " width=30>"

  • When I run into these issues I try to first break down my formula into parts to figure out which part is causing the problem. 

    • Have you double checked that your file attachment field id is in fact 30? 
    • If you remove the style attributes entirely but leave the rest of the formula, does your image show up (albeit full size)? If so, your file access URL is at least correct.
    • If so, and you remove the style attributes and just use "src = '...' width='200px'" (not inside of style) does it work? If not, try '200', '200pt', etc. (Probably just me not knowing how to use HTML properly, but I've sometimes found success with changing units). If that works, your max-height/max-width attributes may be causing the problem (I've had this happen before, but I ended up resolving it by hardcoding in the aspect ratio for scaling properly).
    • If the image does not  appear after removing the style attributes, try checking the "allow open access" box on the File Attachment field settings. This is necessary if you are wanting to insert the image into an Exact Forms Plus document or similar, but I've found it sometimes seems necessary within the application itself, too. 

       

    • JohnRomano's avatar
      JohnRomano
      Qrew Trainee

      Thank you both for the replies. I've tried both and still no image. My field type is Rich Text formula, this is correct?? The field ID with the image attachment is field ID #21. Am I not correctly using the [Record ID #] in the formula?

      If([Image File (jpeg)]
      <>"" ,"src='" & URLRoot() & "up/" & Dbid () & "/a/r" & [Record ID#] & "/e30/v0'/>"
      )

  • John, change the e30 to e21 and it should work.  The formula needs to know which field has the image attachment.

    • JohnRomano's avatar
      JohnRomano
      Qrew Trainee

      Got it! This solved the issue. 

      Thank you very much!