0

Photo field alignment

Hello,

a photo field is always aligned on the left when laying out a view. I need to have more fields on its left or even a space to center it on the page. Is there a way to do it?

Thank oyu very much

31replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
    • Sean
    • Sean
    • 1 yr ago
    • Reported - view

    You can do it using a Formula field and the html() function. This is how you can do it using the Mac app and a local database...

     

    html("<img src=""/Users/YourUserName/Library/Containers/de.ninoxdb.ninox-mac.Ninox/Data/Documents/data/zImageTest/files/C/1/shutterstock_307218608.jpg"">")

     

    I haven't done it using the Cloud version, but Jacques or someone else can probably help with that. You'll have to use the API.

    Like
    • Blued
    • Blued
    • 1 yr ago
    • Reported - view

    Hi Sean, thank you very much for your reply.

    I am struggling to understand that peice of code, bear with me.

    Also, since I am in a dynamic view, the formula would need to point to a different picture depending on the selected record. I am using the Mac app and a local db.

     

    Thanks!

    Like
    • Sean
    • Sean
    • 1 yr ago
    • Reported - view

    Hi Blued,

    From the outside to the inside... The html() function lets you run HTML, CSS and some JavaScript in a Formula field. <img src=...> is just an HTML image tag. The rest is the file path to the image file. "zImageTest" is my database name. "C" is the 3rd table in the database. "1" is the record number in the table. To do it dynamically I think you can use the files() function, but you might have to do some parsing to get the file name right. I don't have time to check that right now.

     

    If you don't see "Library" in Finder, press command+shift+.

    Like
    • Sean
    • Sean
    • 1 yr ago
    • Reported - view

    If you know that there is only one image attached per record you can use this formula and you only need to enter your Mac user name and the Ninox database name.

     

    html("<img src=""/Users/YourUserName/Library/Containers/de.ninoxdb.ninox-mac.Ninox/Data/Documents/data/YourDatabaseName/files/" + extractx(text(files(this)), "(\w)(.+)", "$1/$2") + """>")

     

    Otherwise, you'll need to filter out the correct image file.

    Like
    • Blued
    • Blued
    • 1 yr ago
    • Reported - view

    Hi Sean,

     

    I do appreciate your support.

    Yes there is only one picture per record. I have updated your formula with my username and database name but there is no result, a small question mark icon is displayed in the formula field.

    Also, I am displaying more records (one picture each) in the same view as I built a genealogical tree: I can display all records info depending on the genealogical relation, picture included, I just need to align/place the pic not on the left of the screen.

    Again, thank you very much for your time

    Like
    • Umberto
    • Umberto
    • 1 yr ago
    • Reported - view

    Hi Blued,

    I am very interested to know how you managed to make in Ninox the application to build the family tree. Would you be so kind to give me this information?

    Thank you very much.

    Umberto

    Like
    • Blued
    • Blued
    • 1 yr ago
    • Reported - view

    Hi Umberto,

    firstly each record as a unique ID (not the incremental one automatically created by Ninox at the moment of the creation of the record). Secondly each record as a "father" and a "mother" fields with those unique IDs. This is the parental link.

    The visual representation is with a view and I used empty "free text" fields with borders to represent the family tree. It is surely not elegant but it is working. Of course, it is a static tree and only parents and grandparents are displayed, no simblings nor uncles and haunts.

     

    I hope it helps

    Like
    • Sean
    • Sean
    • 1 yr ago
    • Reported - view

    Blued,

    As long as you are doing this in a Form view and not a View layout element, it should work. The problem might be using the "this" keyword. I was able to display more than one image this way...

     

    html("<img src=""/Users/YourUserName/Library/Containers/de.ninoxdb.ninox-mac.Ninox/Data/Documents/data/YourDatabaseName/files/" + extractx(text(files(record(YourTableName,NinoxRecordId))), "(\w)(.+)", "$1/$2") + """ style=""display: block; margin-left: auto; margin-right: auto; padding: 10px 0px 0px 0px;"">")

    Like
    • Sean
    • Sean
    • 1 yr ago
    • Reported - view

    Here it is without the "style" part...

     

    html("<img src=""/Users/YourUserName/Library/Containers/de.ninoxdb.ninox-mac.Ninox/Data/Documents/data/YourDatabaseName/files/" + extractx(text(files(record(YourTableName,NinoxRecordId))), "(\w)(.+)", "$1/$2") + """>")

    Like
    • Umberto
    • Umberto
    • 1 yr ago
    • Reported - view

    Thanks Blued
    I will follow your suggestions. In case I will involve you again if you agree.
    Good work.

    Like
    • Blued
    • Blued
    • 1 yr ago
    • Reported - view

    Hi Sean,

     

    I am doing it in a tab of a view..... I guess this might be the issue for me then.

    Like
    • Sean
    • Sean
    • 1 yr ago
    • Reported - view

    Blued,

    That should be ok. As long as you aren't trying to display it in one of the table views, Table, Sub Table, View layout element, but it doesn't sound like that's what you're doing. I would remove the html() function from the formula and the Forumula field will display the img tab with the file path. Then follow the path in Finder and confirm whether they match or not.

    Like
    • Blued
    • Blued
    • 1 yr ago
    • Reported - view

    Hi Sean,

     

    it did work in the sense the path and the jpg filename are displayed in the formula field. But as soon as add the html() formula then the error comes again.

    (Somehow I cannot add here the scrrenshot image)

    Like
    • Sean
    • Sean
    • 1 yr ago
    • Reported - view

    You don't need to upload an image for this...

     

    Please copy and paste the result of the formula without the html() function. Then, follow the file path in Finder all the way to the image file in that formula. Ctrl-click that file and select copy file path and paste that here also.

    Like
    • Blued
    • Blued
    • 1 yr ago
    • Reported - view

    result from formula:

    /Users/Vittorio/Library/Containers/de.ninoxdb.ninox-mac.Ninox/Data/Documents/data/Erythrure/files/A/427/m_a.jpeg

     

    I can't see folder "427" and file "m_a.jpg" in Finder. I can only follow down to folder "A" that is empty

    /Users/Vittorio/Library/Containers/de.ninoxdb.ninox-mac.Ninox/Data/Documents/data/Erythrure/files/A

     

    folder "427" as per result of the formula is acutally the record ID and also filename is correct in the formula result

    Like
    • Sean
    • Sean
    • 1 yr ago
    • Reported - view

    Yes, that is how Ninox organizes and stores attachments. The letter is the table and the number is the record id. See if you can find a number folder with a file in it and try that image.

    Like
    • Sean
    • Sean
    • 1 yr ago
    • Reported - view

    Blued,

    I updated to the latest version of Ninox and now I get the same result you have gotten. Hopefully, they will get this bug resolved soon.

    Like
    • Sean
    • Sean
    • 1 yr ago
    • Reported - view

    Bump... because of spam

    Like
    • Blued
    • Blued
    • 1 yr ago
    • Reported - view

    Sean,

    it doesn't solve the issue but at least it was not my fault... :)

    Thanks a lot for your time so far

    Like
    • Umberto
    • Umberto
    • 1 yr ago
    • Reported - view

    I too have updated Ninox to version 3.2.7 and I can only see the images in table mode but not in single record mode nor in pdf. I hope the bug will be fixed soon.

    Like
    • Sean
    • Sean
    • 1 yr ago
    • Reported - view

    Blued,

    Version 3.2.10 fixed the problem for me.

    Like
    • Blued
    • Blued
    • 1 yr ago
    • Reported - view

    Hi Sean,

    issue persists even with 3.2.10

    Like
    • Sean
    • Sean
    • 1 yr ago
    • Reported - view

    Blued,

    Were you ever able to find any directories with an image file in it using Finder? I have added images to my database manually and using code and there is always an image file in the directory for a given record.

    Like
    • Sean
    • Sean
    • 1 yr ago
    • Reported - view

    Also, if I delete the image from the directory it will still be displayed in the database, but if I click on the image field I get the error - "This image failed to load".

    Like
    • Blued
    • Blued
    • 1 yr ago
    • Reported - view

    Sean,

     

    yes I did.

    I could find in Finder the same file at the path that I got as result of the formula without html() function.

    As long as I am adding the html() function image is not loaded/appearing.

    Like
Like Follow
  • 1 yr agoLast active
  • 31Replies
  • 2444Views