Can't display logo in details tab

A place for users and developers of the Xataface to discuss and receive support.

Can't display logo in details tab

Postby obscenic » Mon Jul 09, 2012 12:29 am

With a pretty stock template, I'm having issues seeing my records logos displayed in the details view. There is just a link to "View Field Content In New Window ()". I want it to display the logo stored in a BLOB in the DB. My fields.ini has logo=1 in it under the correct field. I have a field in the DB with the same name plus _MIMEYPE appended with 'jpeg' as the content for the rows where it matters (it is jpg BLOBs). I tried image/jpeg as well with no luck.

Any hints?
obscenic
 
Posts: 6
Joined: Mon Jul 09, 2012 12:24 am

Re: Can't display logo in details tab

Postby obscenic » Mon Jul 09, 2012 8:18 am

Hmm, so I've sort of got it figured - I just had to lowercase the _mimetype suffix in the database. That said, I'm going to be constantly merging databases with this one, which won't have the mimetype field - and I would like to not have to have that field at all to keep it clean. Is there any way to display these images without having this field in the database?
obscenic
 
Posts: 6
Joined: Mon Jul 09, 2012 12:24 am

Re: Can't display logo in details tab

Postby shannah » Thu Jul 12, 2012 11:06 am

Xataface will only display it as a logo if it knows it is an image. The only way it knows how to do this is by checking another field of the same record for the mimetype. The default field is <BLOBFIELDNAME>_mimetype. However, if you have the mimetype recorded in a different field, you could specify the name of this field in the mimetype directive for the field in the fields.ini file.
e.g.
Code: Select all
[myblobfield]
    mimetype=name_of_mimetype_field


If the table doesn't have such a field, then you could just graft a field onto the table using the __sql__ directive and hardcode the mimetype.
e.g.
Code: Select all
__sql__ = "select t.*, 'image/png' as blobfield_mimetype from table t"
...


-Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Can't display logo in details tab

Postby obscenic » Wed Jul 18, 2012 4:16 pm

Perfect workaround! Thanks - I do know what it will be always, forever, and until the end of time: jpeg. I had forgotten about faking SQL results. Thanks for putting out such an awesome project Steve. It's truly amazing and I'm really excited to release my app once it's done (it's a web frontend for a currently non-web based popular library software).
obscenic
 
Posts: 6
Joined: Mon Jul 09, 2012 12:24 am

Re: Can't display logo in details tab

Postby obscenic » Wed Jul 18, 2012 5:14 pm

Hmm, would that be a definition in fields.ini or relationships.ini? It doesn't seem to work in either...
obscenic
 
Posts: 6
Joined: Mon Jul 09, 2012 12:24 am

Re: Can't display logo in details tab

Postby shannah » Thu Jul 19, 2012 12:31 pm

In the fields.ini
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Can't display logo in details tab

Postby obscenic » Thu Aug 23, 2012 3:53 pm

Does this look correct?

Code: Select all
[IMAGE1_DATA]
__sql__ = "SELECT AUDIOWARE.IMAGE1_DATA, 'image/jpeg' AS IMAGE1_DATA_mimetype FROM TABLE AUDIOWARE"
type = blob
widget:type = file
logo=1


Where the table name is AUDIOWARE and the blob with the image data is called IMAGE1_DATA ? I have this in fields.ini and I'm still getting a "View Field Content In New Window ()" link instead of the image...
obscenic
 
Posts: 6
Joined: Mon Jul 09, 2012 12:24 am

Re: Can't display logo in details tab

Postby shannah » Tue Aug 28, 2012 4:44 pm

The __sql__ directive would apply for the whole table so it should appear at the beginning of the fields.ini file, not as part of a particular field's section.

Something like:
Code: Select all
__sql__ = "SELECT AUDIOWARE.*, 'image/jpeg' AS IMAGE1_DATA_mimetype FROM AUDIOWARE"
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Can't display logo in details tab

Postby obscenic » Sun Sep 02, 2012 8:05 pm

Thanks so much Steve! It's all working tickety boo now. Really appreciate you helping me out!
obscenic
 
Posts: 6
Joined: Mon Jul 09, 2012 12:24 am


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 27 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved