Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When you open the imce file browser to select/upload a image you can see a list of the images you have in your server.
This list shows the name for every image.
Is there a way to make this list to show a image preview of the image (a thumbnail)?
Update: It seems to me that this is bug since some image files show their preview but not all of them.
See my capture: IMCE file browser
Comment | File | Size | Author |
---|---|---|---|
#16 | imce-Add_image_preview_option_using_security_tokens-1738218-d7-16.patch | 7.56 KB | paulocs |
#15 | imce-thumbnails_with_tokens-1738218-15.patch | 6.59 KB | ron_s |
Comments
Comment #1
chefnelone CreditAttribution: chefnelone commentedComment #2
ufku CreditAttribution: ufku commentedThere is an inline js in imce-content.tpl.php which allows preview of small images. You can find some other preview options there.
Comment #3
mibfire CreditAttribution: mibfire commentedI tryed this with the following settings:
imce.vars.prvstyle = 'thumbnail';
imce.vars.boxW = 100;
imce.vars.boxH = 100;
but not the all images are created as thumbnail as you can see here: http://screencast.com/t/GzSvhpDNeci
Why doesnt this work for all images? Thx
Comment #4
mibfire CreditAttribution: mibfire commentedhttps://drupal.org/project/image_allow_insecure_derivatives
Comment #4.0
mibfire CreditAttribution: mibfire commentedUpdate: It seems to me that this is bug since some image files show their preview but not all of them.
Comment #5
Karol Haltenberger CreditAttribution: Karol Haltenberger commentedThis is not a bug. Already existing images will show up, but new ones will not be generated without the token.
While trying to make the image previews to work with the core security patch, but without modifying the module source I came up with this. The preview style is managed from the settings page.
In the end I had to patch some of the js, because I couldn't manage to override a function. Maybe I'll try again later.
Comment #6
Karol Haltenberger CreditAttribution: Karol Haltenberger commentedComment #7
krem CreditAttribution: krem commentedHi guys,
I got a workaround overriding the imce-file-list.tpl.php:
1. Place 'modules/imce/tpl/imce-file-list.tpl.php' in your template folder
2. Replace
by
I know it is strange to create an extra column before 'name' column but without it the img tag does not work... I am guessing some javascript treatment is involved.
So far no issues, please confirm ;)
Comment #8
errand CreditAttribution: errand commented#7 Works like a charm!
Bravo krem!
Comment #9
volca CreditAttribution: volca commentedThank you, Krem. Helps a lot!
Comment #10
Acertijo CreditAttribution: Acertijo commentedThank you #7
Comment #11
butterwise CreditAttribution: butterwise commented#7 worked for me. Thank you!
Comment #12
ron_s CreditAttribution: ron_s commentedThe problem with #7 is it's loading every picture at full size and scaling it to be 50 pixels wide. If you have a directory with hundreds of images, it could be a huge performance hit.
The pre-Drupal 7.20 method created a tiny thumbnail image of only a few bytes. This approach is not the same.
Comment #13
ron_s CreditAttribution: ron_s commentedFYI, one other problem with the response in #7: the extra
<td>
tag withdisplay:none
causes the IMCE image preview to break.Comment #14
ron_s CreditAttribution: ron_s commented@Karol Haltenberger, I spent some time looking at your code in #5, and created a patch for IMCE that incorporates a lot of the concepts directly into the module.
The one major issue I found was code in the
MODULE_imce_custom_process
function. Thedb_select
assumes thatfilename
in thefile_managed
table is unique, and this is not always the case. Theuri
will be unique, and this value needs to be used for checking, notfilename
.I also added some logic to break out of the javascript if
itok
is undefined. Otherwise there are situations where we will see a broken image in IMCE.Please review the attached patch and let me know if there are any suggestions. Thanks.
(Note: for anyone testing this code, make sure to run update.php and add the image style to be used for the thumbnail in /admin/config/media/imce in the Common settings section at the bottom.)
Comment #15
ron_s CreditAttribution: ron_s commentedPatch #14 no longer applies to the recent version of IMCE. Attached is an updated version for review.
Comment #16
paulocsPatch #15 does not work when images are in root directory so I re-rolled the patch and implemented it.
The problem now is that I couldn't enable thumbnail if the image metadata is disabled.
I create the function imce.getDimensionsImgDataDisable() in imce_extras.js but it is not working to get the image data when the metadata is disabled.
Should I create a message in the config form that is not possible to show images in thumbnail if metadata is disabled or we will wait until we find a solution?
Thanks.