Forum Discussion
- PaulLantermanQrew Memberyup!
with some code courtesy of Chris - (see his original here )
[image] is your attachment field
[name] is the title of your item ( chair, sofa, etc)
i put it in a <div> that's 150px wide with a white background, so it always prints nice,
then put the NAME on the left and the IMAGE on the right, 50px tall.
"<div style=\"background-color:#FFF; width:150px; height:52px; \"> "
&
"<div style=\"float:left; width:60px; color:#636363; font-size:14px; font-family:Arial; \">" & [Name] & "</div>"
&
" <div style=\"float:right;\"><img style=\" height:50px;\" src=\"" & URLRoot() & "up/" & Dbid() & "/a/r" & [Record ID#] & "/e6/v0/" & [image] & "\" ></div> "
&
"</div>
if you just want the image on the report, and they're all the right size, etc, then you just need the brilliant code from Chris to transform the image into a web url...URLRoot() & "up/" & Dbid() & "/a/r" & [Record ID#] & "/e6/v0/" & [Image]
- ArshadKhwajaQrew CommanderIs there a way I can re size a photo in a form so that it is not too big?
- QuickBaseCoachDQrew CaptainTry 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. - ArshadKhwajaQrew CommanderThis is a great response Mark. Thanks.
- ArshadKhwajaQrew CommanderI also picked up the following statement which I added to a formula text and it worked. But I like the idea of testing for an attachment. Is the file attachment 2 in Var is the name of the field?
- QuickBaseCoachDQrew Captainyes, the name of the field in my example was [file attachment 2]
- ArshadKhwajaQrew CommanderThanks a lot. Works great.