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.
I checked the option "Replace the existing file with the new one" in "Common settings" of IMCE configuration. But when I upload a new picture with an already existing name in the file browser, the picture that is shown in the preview wrapper is the old one, and not the file that I 'd just uploaded.
To see the new image, I need to reload the page with F5 keybord key.
How this images refresh in the file browser can be applied automatically when a new file is uploaded ?
Thanks
Comments
Comment #1
lucuhb CreditAttribution: lucuhb commentedComment #2
ufku CreditAttribution: ufku commentedOne way is to override imce.imgHtml() method
This will disable browser cache for images in preview.
Comment #3
lucuhb CreditAttribution: lucuhb commentedThanks you very much.
Actually, with these changes in imce.js, image in preview is automatically refresh , but only in the preview part : the primary image is still displayed in the files list part.
Is there any way to solve this problem ?
It would be nice if your changes in the code of imcs.js are incorporated to the imce release.
Comment #4
ufku CreditAttribution: ufku commentedShould the file disappear from the list??
BTW, you can override any imce method in imce-content.tpl.php file. Copy it to your theme's directory and see how inline javascript is added in it to extend imce.
Comment #5
lucuhb CreditAttribution: lucuhb commentedOf course I don't want the file disappear from the liste, I just want that the little preview in file list is also refresh.
After all, your solution refreshs the image in preview part, but when I return to the fckeditor window, the image shown in this is the initial one and not the new one.
With F5 key of the keybord, images are updated for the imce window and for the fckeditor too.
So I'm not sure that there is a way to replace refreshment by F5 key.
However thanks you for your help.
Comment #6
ufku CreditAttribution: ufku commentedOk, it's clear now. That little thumbnail is created by imce.thumbRow() in imce_extras.js
You can override the line:
img.src = imce.getURL(row.id) + '?' + Math.random()
I can't commit these changes to the project because they disable the browser cache and force a server request whenever an image is previewed. It would be painful when you view a directory containing hundreds of images each shown as a thumbnail in the list.
Comment #7
ufku CreditAttribution: ufku commented