Jump to content

Recommended Posts

Posted

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?

Posted
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

Posted

Here are the settings in my database inside IP.Pages but I’m getting “Array” instead of it showing two thumbnails of images I uploaded for this record.49BF7E22-54EE-4524-85A4-B91EB62632B5.thumb.png.61d2ddf1c8a6e23764166afb05020b01.png84888BA7-3ACD-4EFD-A53A-865AFD2A5019.thumb.png.5c32a2111da2004a996f7ca947196dc0.png5E069CE5-9B16-446A-BCC5-89129AF655B5.thumb.png.538b38432414185e0a63c427cb3f8014.png

Posted

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

Posted

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?

Posted

@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/

Posted

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}}

 

  • Recently Browsing   0 members

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