Forum Discussion

Re: Display a .jpg attachment as an image in a notification

You can try this as a Rich text formula field,

var text FileType = Right(ToText([My file attachment field]),".");

If(Contains("jpg, jpeg, png",$FileType),
"<img src=" & URLRoot() & "up/" & Dbid() & "/a/r" & [Record ID#] & "/e282/v0' width='75' >")

Where 282 would be replaced with the field ID of the file attachment field.

Note that the user will need to have access to the images without logging in.  I suggest checking the box on the file attachment field to allow access without logging in.


------------------------------
Mark Shnier (YQC)
Quick Base Solution Provider
Your Quick Base Coach
http://QuickBaseCoach.com
mark.shnier@gmail.com
------------------------------

5 Replies

  • KarenHenke's avatar
    KarenHenke
    Qrew Cadet
    Worked perfectly, thanks Mark!

    ------------------------------
    Karen Henke
    ------------------------------
  • KatherineOakey's avatar
    KatherineOakey
    Qrew Member
    This is the problem I'm currently working on.

    var text FileType = Right(ToText([My file attachment field]),".");

    If(Contains("jpg, jpeg, png",$FileType),
    "<img src=" & URLRoot() & "up/" & Dbid() & "/a/r" & [Record ID#] & "/e282/v0' width='75' >")

    [My file attachment field]   I assume is the field in the table that has the actual image.  Currently, my desired logo image is in a child table of the table the notification is being used on.   I want to use the same logo image for every notification that is sent.



    Using just the <img src=     &displays the URL - yes, I can go to a browser, paste the URL in and it displays.

    I have the pixel sizing for the image and I want to resize it smaller.  If I specify only a width, will the height be calculated on the aspect of the image?

    This is what I currently have and still a URL and not the image itself.

    var text FileType = Right(ToText([Images:Image]),".");

    If(Contains("jpg, jpeg, png",$FileType),
    "<img src=" & URLRoot() & "up/" & Dbid() & "/a/r" & 24 & "/e6/v0' width='75' >")

    & 24 is the Record Id of the actual image
    e6 is the field ID for the Image field

    ------------------------------
    Katherine Oakey
    ------------------------------
    • MarkShnier__You's avatar
      MarkShnier__You
      Icon for Qrew Legend rankQrew Legend
      The field type should be set to formula Rich text.
      Make sure you check the box in the file attachment field 

      "Allow access to this file attachment from a Quickbase link without signing in"

      You can set either the Width or change the parameter to Height,  and it will properly scale.  But do not set both or it will get skewed and distorted.

      Then it should work.

      ------------------------------
      Mark Shnier (YQC)
      Quick Base Solution Provider
      Your Quick Base Coach
      http://QuickBaseCoach.com
      mark.shnier@gmail.com
      ------------------------------
      • KatherineOakey's avatar
        KatherineOakey
        Qrew Member
        The field type of the Image field?

        Which field needs to be RTF?

        The notification message field is set to Message Format HTML.  I changed Interpret Custom Message as HTML to Yes and now I see the URL and a broken link icon.

        I know the file is externally available as I can paste the URL into Chrome and the image displays.


        Kathy Oakey
        University of Arizona Cooperative Extension
        Maricopa Master Gardener