Forum Discussion
QuickBaseCoachD
8 years agoQrew Captain
Try this format for a formula text field with html enabled and where the actual file attachment has been uploaded to field ID 282.,
var text FileType = Right(ToText([file attachment2]),".");
If(Contains("jpg, jepg, png",$FileType),
"<img src=" & URLRoot() & "up/" & Dbid() & "/a/r" & [Record ID#] & "/e282/v0' width='75' >")
You can adjust the width to different values until you get the size you like.
Alternatively you can use this to control the height. The only difference is that we are specifying the height and not the width. (you can also specify both, but then the image may get skewed in either the height or the width.
var text FileType = Right(ToText([file attachment2]),".");
If(Contains("jpg, jepg, png",$FileType),
"<img src=" & URLRoot() & "up/" & Dbid() & "/a/r" & [Record ID#] & "/e282/v0' height='75' >")
The purpose of the IF is to display nothing if there is not file attachment or if the file attachment is not an image. For example, this will not work for an Excel, PDF, or Word attachment.
var text FileType = Right(ToText([file attachment2]),".");
If(Contains("jpg, jepg, png",$FileType),
"<img src=" & URLRoot() & "up/" & Dbid() & "/a/r" & [Record ID#] & "/e282/v0' width='75' >")
You can adjust the width to different values until you get the size you like.
Alternatively you can use this to control the height. The only difference is that we are specifying the height and not the width. (you can also specify both, but then the image may get skewed in either the height or the width.
var text FileType = Right(ToText([file attachment2]),".");
If(Contains("jpg, jepg, png",$FileType),
"<img src=" & URLRoot() & "up/" & Dbid() & "/a/r" & [Record ID#] & "/e282/v0' height='75' >")
The purpose of the IF is to display nothing if there is not file attachment or if the file attachment is not an image. For example, this will not work for an Excel, PDF, or Word attachment.