Kirill Gromov Posted September 28, 2017 Posted September 28, 2017 Hello, guys! How can I display thumbnail image of the upload field in the Pages display template?
opentype Posted September 28, 2017 Posted September 28, 2017 The Pages upload field doesn’t create a thumbnail image unfortunately. It is bugging me since 4.0.
Kirill Gromov Posted September 28, 2017 Author Posted September 28, 2017 @opentype, thanks! Have you tried adding this to the bug tracker IPS?
opentype Posted September 28, 2017 Posted September 28, 2017 Well, it’s bugging me, but it’s not a bug. 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.
Daniel F Posted September 28, 2017 Posted September 28, 2017 You can use $record->customFieldDisplayByKey('test-upload', 'thumbs’); to get the thumbnail of the field with the key "test-upload".
opentype Posted September 28, 2017 Posted September 28, 2017 Wow! Indeed! 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.
Kirill Gromov Posted September 28, 2017 Author Posted September 28, 2017 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 - In display template: <img class="ipsImage" src="{$record->customFieldDisplayByKey('newimage', 'thumbs')}"> In source code of page: <img class="ipsImage" src="">
opentype Posted September 29, 2017 Posted September 29, 2017 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.
Kirill Gromov Posted September 29, 2017 Author Posted September 29, 2017 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
Daniel F Posted September 29, 2017 Posted September 29, 2017 Could you please try this with a new upload and not already existing one?
Kirill Gromov Posted September 29, 2017 Author Posted September 29, 2017 14 minutes ago, Daniel F said: Could you please try this with a new upload and not already existing one? Unfortunately this also does not work..
Daniel F Posted September 29, 2017 Posted September 29, 2017 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
Kirill Gromov Posted September 29, 2017 Author Posted September 29, 2017 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!
Kirill Gromov Posted October 4, 2017 Author Posted October 4, 2017 @Daniel F, can you confirm that this is a bug?
opentype Posted December 25, 2017 Posted December 25, 2017 I can confirm the behavior. Only one thumbnail in the thumbnail table at a time. Have you opened a bug report, Kirill?
Kirill Gromov Posted January 3, 2018 Author Posted January 3, 2018 1 minute ago, opentype said: I now reported it in ticket #996432 Matt said that the bug is fixed in 4.2.7
Management Matt Posted January 4, 2018 Management Posted January 4, 2018 On 03/01/2018 at 8:31 AM, Kirill Gromov said: Matt said that the bug is fixed in 4.2.7 It is.
opentype Posted January 4, 2018 Posted January 4, 2018 Can I test this in the beta already, and if so, which version?
Daniel F Posted January 4, 2018 Posted January 4, 2018 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.
opentype Posted January 4, 2018 Posted January 4, 2018 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. 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? How do I do the same in the field settings (“Listing/Display Custom Format”) where there is just $value and $formValue normally?
opentype Posted January 12, 2018 Posted January 12, 2018 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.
Kirill Gromov Posted January 12, 2018 Author Posted January 12, 2018 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!
opentype Posted January 12, 2018 Posted January 12, 2018 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?
Recommended Posts
Archived
This topic is now archived and is closed to further replies.