Data at Your Fingertips: Explore Our New Reporting and Statistical Capabilities By Ryan Ashbrook Yesterday at 01:29 PM
Kirill Gromov Posted September 28, 2017 Share Posted September 28, 2017 Hello, guys! How can I display thumbnail image of the upload field in the Pages display template? Link to comment Share on other sites More sharing options...
opentype Posted September 28, 2017 Share Posted September 28, 2017 The Pages upload field doesn’t create a thumbnail image unfortunately. It is bugging me since 4.0. Link to comment Share on other sites More sharing options...
Kirill Gromov Posted September 28, 2017 Author Share Posted September 28, 2017 @opentype, thanks! Have you tried adding this to the bug tracker IPS? Link to comment Share on other sites More sharing options...
opentype Posted September 28, 2017 Share 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. Link to comment Share on other sites More sharing options...
Daniel F Posted September 28, 2017 Share Posted September 28, 2017 You can use $record->customFieldDisplayByKey('test-upload', 'thumbs’); to get the thumbnail of the field with the key "test-upload". Link to comment Share on other sites More sharing options...
opentype Posted September 28, 2017 Share 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. Link to comment Share on other sites More sharing options...
Kirill Gromov Posted September 28, 2017 Author Share 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=""> Link to comment Share on other sites More sharing options...
Kirill Gromov Posted September 29, 2017 Author Share Posted September 29, 2017 @Daniel F, its a bug? Link to comment Share on other sites More sharing options...
opentype Posted September 29, 2017 Share 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. Link to comment Share on other sites More sharing options...
Kirill Gromov Posted September 29, 2017 Author Share 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 Link to comment Share on other sites More sharing options...
Daniel F Posted September 29, 2017 Share Posted September 29, 2017 Could you please try this with a new upload and not already existing one? Link to comment Share on other sites More sharing options...
Kirill Gromov Posted September 29, 2017 Author Share 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.. Link to comment Share on other sites More sharing options...
Daniel F Posted September 29, 2017 Share 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 Link to comment Share on other sites More sharing options...
Kirill Gromov Posted September 29, 2017 Author Share 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! Link to comment Share on other sites More sharing options...
Kirill Gromov Posted October 4, 2017 Author Share Posted October 4, 2017 @Daniel F, can you confirm that this is a bug? Link to comment Share on other sites More sharing options...
opentype Posted December 25, 2017 Share 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? Link to comment Share on other sites More sharing options...
opentype Posted January 3, 2018 Share Posted January 3, 2018 I now reported it in ticket #996432 Link to comment Share on other sites More sharing options...
Kirill Gromov Posted January 3, 2018 Author Share 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 Link to comment Share on other sites More sharing options...
Management Matt Posted January 4, 2018 Management Share 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. Link to comment Share on other sites More sharing options...
opentype Posted January 4, 2018 Share Posted January 4, 2018 Can I test this in the beta already, and if so, which version? Link to comment Share on other sites More sharing options...
Daniel F Posted January 4, 2018 Share 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. Link to comment Share on other sites More sharing options...
opentype Posted January 4, 2018 Share 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? Link to comment Share on other sites More sharing options...
opentype Posted January 12, 2018 Share 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. Link to comment Share on other sites More sharing options...
Kirill Gromov Posted January 12, 2018 Author Share 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! Link to comment Share on other sites More sharing options...
opentype Posted January 12, 2018 Share 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? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.