Jump to content

Pages: Record Field Database Not Returning Upload / Thumbs


Meowcious
 Share

Recommended Posts

Hello!

I set up a database with a key of designer_examples and the field type is set to upload and allow multiple uploads and allow thumbnails so that a record entry could show the designers example of work.

On display type I’ve set to custom and used the following:

 

{$record->customFieldDisplayByKey('designer_examples', 'thumbs')|raw}
 

This should return thumbnails of the uploaded images but I’m just getting “Array”. Same if I set the view type to ‘upload’. It is working if I use view type of listing, it does list the two images and their links. Any ideas?

Link to comment
Share on other sites

10 minutes ago, xtech said:

You should check in the SQL database what that field has inside. If it is returning an array, you need to iterate it.

I’m pretty sure the field has the image so it’s the url.jpg for example. What do you mean by iterate it? Sorry, newbie here

Link to comment
Share on other sites

When you put )|raw, it gets literally what it is stored at the SQL database with no parsing. The "listing" template parses it, so that's why you get the link and the thumb.

 Therefore, i would look into the SQL database to check what it has inside. If it is an array, you cannot directly have the url.jpg, as it has more than one item.

I have never used such a field so i am not particulary familiar on how it is stored at the SQL database

Link to comment
Share on other sites

Interesting. What is the solution then to show these images as the listing documentation states if the ‘thumbs’ or ‘upload’ listing view type isn’t working properly? Maybe I’m doing something wrong for this to not be showing thumbnail images?

Link to comment
Share on other sites

@Meowcious

Use something like this:

{{foreach $value as $img}}
            	<a href='{$img}' data-ipsLightbox data-ipsLightbox-group="other_images_{$record->_id}" title='{$record->_title}'><div class='pb_other {{if $counts == 5}}ipsHide{{endif}}' data-background-src='{$img}' style='background: center top; background-size: cover;'>
            	</div></a>
{{endforeach}}

Not exactly as this is super custom for my site but it should cycle through them and show them. You can see an example as the images under the main image here:

https://rpginitiative.com/pb-directory/

Link to comment
Share on other sites

Sorry, the code above is pretty CSS heavy. You may want to change it to this:

{{foreach $value as $img}}
            	<a href='{$img}' data-ipsLightbox data-ipsLightbox-group="other_images_{$record->_id}" title='{$record->_title}'><img src='{$img}'>
            	</a>
{{endforeach}}

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...