Jump to content

Displaying thumb image of upload field in Pages


Kirill Gromov

Recommended Posts

Posted

Well, it’s bugging me, but it’s not a bug. :lol:

Feel free to post it again in the feedback forum as feature request describing your use case. I think I did it before, but that was forever ago. 

Posted

Wow! Indeed! 

59cd0a51b7b61_Bildschirmfoto2017-09-28um16_41_52.thumb.png.2ec752fabd92ec4f405dd2a294505ebe.png

When was that added? If these things are not in the release announcements, there should be posts in the feedback forums telling us that they were added. Same with “https images for older post content”. I keep waiting for these features and have no idea they are there already. 

Posted
45 minutes ago, Daniel F said:

to get the thumbnail of the field with the key "test-upload".

@Daniel F Don't working for me:

Settings - 59cd0c3f9e093_2017-09-2817_50_15.thumb.png.d6adfa9dad5c034ff7d497f1a3de9e50.png

In display template:

<img class="ipsImage" src="{$record->customFieldDisplayByKey('newimage', 'thumbs')}">

In source code of page:

<img class="ipsImage" src="">

 

Posted

I haven’t tested it, but Daniel’s call will probably produce a processed output with complete HTML, not an individual file URL. So you can’t call that within the img src attribute. Try to output it by itself and see what it does. 

Posted
12 minutes ago, opentype said:

I haven’t tested it, but Daniel’s call will probably produce a processed output with complete HTML, not an individual file URL. So you can’t call that within the img src attribute. Try to output it by itself and see what it does. 

I have already tried to do this, it does not display anything

Posted

I'm sorry this method returns an array

{{foreach $record->customFieldDisplayByKey('img', 'thumbs') as $image}}
<img src="{$image}" />
{{endforeach}}

I have raised an internal discussion about this, since no other call of customFieldDisplayByKey returns an array

Posted
4 hours ago, Daniel F said:

I'm sorry this method returns an array

@Daniel F Thanks, it works, BUT show thumbnail of last record in the database. I checked the table that stores thumbnails of the uploads field and I see only one record!! Thus, as soon as a new article is added to the database, the thumbnail is overwritten, and the old one is deleted. This is a bug!

  • 2 months later...
  • 2 weeks later...
Posted
2 minutes ago, opentype said:

Can I test this in the beta already, and if so, which version?

The recent beta should include this, but please see also my ticket response ;) My gut feeling tells me that we're not talking about the same issue here.

Posted

I am talking about what Kirill is talking about. ;-)
I just tested on beta 4 and the table looks okay and the output in the template works with this code

So, yeah, the bug seem to be fixed. 

I am still unsure about accessing the thumbs. 

  1. How do I access all regular images and thumbs of the same field at the same time in a template? For example to create a little gallery of the thumbs linking to the full-size images?
  2. How do I do the same in the field settings (“Listing/Display Custom Format”) where there is just $value and $formValue normally?
  • 2 weeks later...
Posted
14 minutes ago, opentype said:

Upgraded my sites, but I still can’t retrieve the thumbnails. That Foreach loop from Daniel doesn’t work for me and I don’t even know what else I could try. 

True code:

<img src="/uploads/{$record->record_image_thumb}">

This bug is fixed, thanks for this, IPS Team!

Posted

Well, no. That code is for the record image, not an upload field. The record image had working thumbnails for a long time. 

(Also, there is usually no need to hardcode the file path. Just use {file='$record->record_image_thumb' extension='cms_Records'} )

@Daniel F? Can you help?

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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