#1 April 26, 2016 10:53am

jmason03
Member
Registered: January 9, 2014
Posts: 123

Images as titles for Matrices

I've been working on how the titles/subtitles are displayed in matrices and callouts when an image upload field is selected as the title. I have the code for main.js done so that if an image exists and it is marked as the title, then it is visually displayed and the subtitle is hidden (see picture below). In all other cases, just the filename of the image is used. But before I went in and began working on editing the draw fields for callouts/matrices, I wanted to ask if this is something you would be willing to incorporate into BigTree once it is finished? Since it's such a specific use case and involves modifying some pretty important files, I didn't think it would be worth it for us to create it and then and have to run all those files through /custom from here on out.

Thanks

Matrix with Image Title

Offline

#2 April 27, 2016 8:43am

timbuckingham
Administrator
From: Baltimore, MD
Registered: April 2, 2012
Posts: 903

Re: Images as titles for Matrices

That's pretty cool and I'd definitely be down with working it into core if we can get it to a good place. How do you plan on handling the storage of the image data for drawing it back to the callout? Are you going to just base64 encode it and store it in the __internal-title field and draw it as inline image data? I guess for the list style matrices you could store the file name in __internal-subtitle and just have an empty title (or draw a tiny thumbnail in the title field and the filename as the subtitle next to it).

Offline

#3 April 27, 2016 8:58am

jmason03
Member
Registered: January 9, 2014
Posts: 123

Re: Images as titles for Matrices

Yeah that's how I have been doing it so far. For the list view I had thought about just doing the title but I like your idea of a thumbnail with the title, I think that could look really good. The only thing about this that seems slightly less than clean is that I can't let the title/subtitle run through safeEncode like everything else does. So I've just been using strpos to see if the title starts with '<img'. Does that seem like the best way to identify which callouts/matrices are using an image as the title?

Offline

#4 April 27, 2016 9:00am

timbuckingham
Administrator
From: Baltimore, MD
Registered: April 2, 2012
Posts: 903

Re: Images as titles for Matrices

I'd probably go with something a little more future-looking just in case. Maybe storing something like __internal-title-type as "image" when you're storing image data and then checking for the presence of that when drawing the matrix/callout entries.

Offline

Board footer

Powered by FluxBB

The Discussion Forum is not available on displays of this size.