Can a file attachment image thumbnail appear in a report?

  • 2
  • 3
  • Question
  • Updated 7 months ago
  • Answered
It would be nice if there is an option to display a thumbnail version of image file attachments. Is this possible?
Photo of Gena

Gena

  • 30 Points

Posted 6 years ago

  • 2
  • 3
Photo of Mark_Shnier

Mark_Shnier

  • 510 Points 500 badge 2x thumb
This formula will put up a thumbnail.
//"https://www.quickbase.com/up/" & Dbid () & "/a/r" & //[Record ID#] & "/e6/v0\"height=\"1000\" width=\"1250\" target=_blank/> " &
"<img src = https://gesco.quickbase.com/up/" & Dbid () & "/a/r" & [Record ID#] & "/e6/v0\" height=\"300\" width=\"375\" target=_blank />"

note that e6 is the field ID # so change the 6 to whatever your file attachment field ID# is. eg e11 would be for fid 11.
adjust the height and the width of the thumbnail.

If you uncomment out the first two lines you would be able to click it to see a larger thumbnail, but it in neither case does it know how to scale the picture, so probably for full size undistorted viewing it would be best for your users to click on the file attachment file name if they want to see the thumbnail full size.

Don't be adding this thumbnail to large reports and certainly not to the List All report as it takes forever to load when there are hundreds of records.
Photo of Gena

Gena

  • 30 Points
Hi Mark,
Thank you for this response!  I may be doing someting wrong.  I used the following from your formula:

“<img src = https://tamarataylor.quickbase.com/up/&quot; &
Dbid () & "/a/r" & [Record ID#] & "/e8/v0\" height=\"300\" width=\"375\" target=_blank />

I used the new interface.
I put this formula in a report (that has 14 rows).
I created a calculated column in the report; with a field type of URL.

The system is saying there is a syntax error of:  
     Formula syntax error
     A formula must be a valid expression.
           “<img src = https://tamarataylor.quickbase.com/up/&quot; &
           Dbid () & "/a/r" & [Record ID#] & "/e8/v0/" & height=/"300/" & width=/"375/" & target=_blank />
Photo of Mark_Shnier

Mark_Shnier

  • 510 Points 500 badge 2x thumb
Try adding a closing " quote.   I missed that in my copy and paste.
Photo of Gena

Gena

  • 30 Points
It's still failing.

Formula syntax error
There are extra characters beyond the end of the formula.
"<img src = https://tamarataylor.quickbase.com/up/&quot;  ; &
 Dbid () & "/a/r" & [Record ID#] & "/e8/v0\" height=\"300\" width=\"375\" target=_blank />"
Photo of Mark_Shnier

Mark_Shnier

  • 510 Points 500 badge 2x thumb
"<img src=\"https://gesco.quickbase.com/up/&quot; & Dbid () & "/a/r" &
[Record ID#] & "/e6/v0\" height=\"300\" width=\"375\" target=_blank />"

The above is what is working for me. In your post above, I am seeing some semi colons just after the "up/"   Are they really there?  If so, they don't belong there.
Photo of Gena

Gena

  • 30 Points
Hi Mark,
I copied and pasted again - to make sure i didn't miss anything - and I am no longer receiving the error (hurdle 1 - accomplished).  :)
Pasted formula is:

//"https://www.quickbase.com/up/&quot; & Dbid () & "/a/r" &
//[Record ID#] & "/e8/v0\"height=\"1000\" width=\"1250\" target=_blank/> " &
"<img src = https://tamarataylor.quickbase.com/up/&quot; &
Dbid () & "/a/r" & [Record ID#] & "/e8/v0\" height=\"300\" width=\"375\" target=_blank />"

However, the image doesn't appear in the report.  The report shows a url instead.  When clicked, it takes me to the following url that doesn't resolve.  Example:

http://%3cimg%20src%20=%20https//tamarataylor.quickbase.com/up/bhtkhxhbj/a/r1/e8/v0%22%20height=%22300%22%20width=%22375%22%20target=_blank%20/%3E

It seems to be adding extraneous info in the beginning (http://%3cimg%20src%20=%20) and spacers in the end, Is there something additional I need to do?
Photo of Mark_Shnier

Mark_Shnier

  • 510 Points 500 badge 2x thumb
Click the checkbox on the field properties to enable HTML. :)
Photo of Gena

Gena

  • 30 Points
:)  I was trying to do it as a calculated column in the report - and not an actual field.  

I will work to add it as a field. :)  thanks for all of your assistance :)
Photo of Gena

Gena

  • 30 Points
It works! thx.
Photo of Pat

Pat

  • 10 Points
Is it possible to do the same thing only for a video file instead?  Is there an html tag for embedding video?
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,044 Points 20k badge 2x thumb
Use the HTML5 <video> tag to embed a video.
Photo of Pat

Pat

  • 10 Points
I've been playing around with the <video> tag and can't seem to get it to work.  I was under the impression it was because the <video> tag was not supported.  Do you know for certain that this tag is supported?  Here's what the formula looks like:

"<video src=https://intersystems.quickbase.com/up/&quot; & Dbid () & "/a/r" &
[Record ID#] & "/e9/v0\" width=\"170\" height=\"85\" controls>\n<p>If you are reading this, it is because your browser does not support the HTML5 video element.</p>\n</video>"
Photo of Ryan

Ryan

  • 0 Points
Mark, I'm trying to get the thumbnail photo to enlarge as you mentioned will happen if the first 2 lines are uncommented. So this is what I have:

"https://www.quickbase.com/up/&quot; & Dbid () & "/a/r" &
[Record ID#] & "/e27/v0\"height=\"800\" width=\"1000\" target=_blank/> " &

"<img src = https://gesco.quickbase.com/up/&quot; & Dbid () & "/a/r" &
[Record ID#] & "/e27/v0\" height=\"200\" width=\"250\" target=_blank />"

When displayed though it shows  "https://www.quickbase.com/up/biajkmurz/a/r4/e27/v0"height="800&quot; width="1000" target=_blank/>" to the left of the thumbnail photo.

It appears that the top lines are missing an "<" but I tried putting it at the beginning and it still didn't work.
Can you help?

Thanks!
Ryan
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,310 Points 50k badge 2x thumb
yes, it look like my posted answer was missing the <a href part at the beginning.

Here is one that works. I see that when I pasted it in, this forum lost some of my formula. Note that you will need to remove the extra spaces in the h r e f and the and w w w

If you don't want a new window, then you leave out the target = blank.

"<a h r e f=\"h t t ps://mycompany.quickbase.com/up/" & Dbid () & "/a/r" &
[Record ID#] & "/e6/v0\"height=\"1000\" width=\"1250\" target=_blank/> " &
"<img src=\"h t t p s://mycompany.quickbase.com/up/" & Dbid () & "/a/r" &
[Record ID#] & "/e6/v0\" height=\"300\" width=\"375\" target=_blank />"

Also since I made that formula I now realize that you should just specify a width or a height (but not both), and it will automatically scale the missing one. If you specify both, then it forces an aspect ratio distort the original photo.
Photo of mvelicu

mvelicu

  • 110 Points 100 badge 2x thumb
Hi ,
I use your formulas for creating a field,thank you very much ,  It shows well in a report, but when I click on the image, the current firefox tab goes from report display to the current record display , and then it opens another tab where it shows the picture.
What I don't like is the current tab behaviour . I don't want to see the view of the current record, I want to stay on the report page.
Do you know  how I can accomplish this ?

Thanks,
Mihai
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,310 Points 50k badge 2x thumb
The solution is to change the report to not allow to view the record. (uncheck the view box).

But then you ask "but how do they view thew record?"

Make a view button as a URL formula and make it be the first column on the report.  Label the button is just V to keep it short.

urlroot() & "db/" & dbid() & "?a=dr&rid=" & [record ID#] 
Photo of mvelicu

mvelicu

  • 110 Points 100 badge 2x thumb
Thanks, it worked

best regards,
Mihai
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,310 Points 50k badge 2x thumb
Yep, been there, done it, bought the T shirt :).  I was bit by that same problem.
Photo of Johnny QuickBase

Johnny QuickBase

  • 300 Points 250 badge 2x thumb
I can't find where I get the attachment ID
Photo of Johnny QuickBase

Johnny QuickBase

  • 300 Points 250 badge 2x thumb
nevermind
Photo of Satyen Vora

Satyen Vora

  • 70 Points
/v0\ speaks to the version number. if you have something that may have iterations you will want to consider how best to approach it. I removed it from the coding, but it's probably not the best option. Is there a way to have it check the most recent version, like /v%\ or similar syntax?
Photo of Matthew Neil

Matthew Neil

  • 31,678 Points 20k badge 2x thumb
v0 is the most recent version.  Odd I know.

v1 is the most recently replaced.

v3 would be the oldest available version if you allow up to 3 revisions, etc
(Edited)
Photo of Satyen Vora

Satyen Vora

  • 70 Points
When I had it as v0 the image preview did not update when it was replaced with a new image (not even v1, but deleted and replaced completely). 
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,310 Points 50k badge 2x thumb
It's an issue with cacheing in your browser settings.  I don't claim to b an expert and it will depend on the Browser you are using, but there will be a setting in their somewhere as to if the browser will chache content. They do that to speed up rendering on the screen, but the result is that it may render old data.

If you are stuck, let me know which browser you are using and I will have a look at my similar settings.
Photo of Meredith Moore

Meredith Moore

  • 556 Points 500 badge 2x thumb
Ok I am pretty confused, I have copied and pasted everything, re-read the thread 20 times and just trying to figure out why nothing is showing up. This is what I pasted into my Text Formula field:

"<a href=\"https://xxxx.quickbase.com/up/"; & Dbid () & "/a/r" & 
[Record ID#] & "/e8/v0\"height=\"1000\" target=_blank/> " & 
"<img src=\"https://xxxx.quickbase.com/up/"; & Dbid () & "/a/r" & 
[Record ID#] & "/e8/v0\" height=\"200\" target=_blank />"
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,310 Points 50k badge 2x thumb
I can help but just to be clear what you are you trying to do?  Are you trying to just display an icon  and the user will click to then display a file attachment?

Without putting much though into it yet, I see that there are semi colons in your formula in two places.  Can you try it by removing them and them post back your formula if that does not correct the problem.
Photo of Jeff

Jeff

  • 186 Points 100 badge 2x thumb
It doesn't seem to be working for PDF attachments. Thoughts?
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 62,782 Points 50k badge 2x thumb
Right, this is for image files like a jpeg.  There is no native PDF viewer in Quick Base at this time.
Photo of Tim Beaulieu

Tim Beaulieu

  • 130 Points 100 badge 2x thumb
I answered my own question while typing this... seems like it would be worth sharing. 

I figured out how to hide the empty img preview field from the form.

Solution: 
Form rule--> When (attachment field) Photo 1 > 0, show Img preview

Photo of Harrison Hersch (QB)

Harrison Hersch (QB), Quick Base Sr. Product Manager (Platform)

  • 1,398 Points 1k badge 2x thumb
Hi, Tim. You can also do this inside of the formula by encasing the entire thing in an IF and checking if the file is empty.
Photo of Josh Collins

Josh Collins

  • 422 Points 250 badge 2x thumb
Hey Mark, thank you for all the info on this thread.  I have everything working except one small issue: I am trying to pull the image from a different Quick Base application where I host all my images.  The images are the front image of house plans. I created a url field in App1 --> House Plan table that uses a url from App1 --> image that I want to use.  The App1 field opens the image fine if I click on the link, but if I reference the App1 field ID in the formula for the thumbnail image, I just get a blank image placeholder.

My formula is:

"<ahref=\"https://www.quickbase.com/up/"; & Dbid () & "/a/r" & [Record ID#] & "/e35/v0\"height=\"1000\" width=\"1250\" target=_blank/> " &"<img src = https://prespro.quickbase.com/up/"; & Dbid () & "/a/r" & [Record ID#] & "/e35/v0\" height=\"60\" width=\"75\" target=_blank />"

Would you be able to help with this?

Thank you!

This conversation is no longer open for comments or replies.