Is it possible with this module to just replace an existing image in a media folder without having to first delete the existing image and then re-uploading a new version? It appears that currently you cannot just replace an existing image with the same image (same file name) by adding that file. When I add the same image now it just dupes it and adds a copy.

Does the roadmap for this module have this functionality as part of the overall plan? Or is it possible now?

-Trevor

CommentFileSizeAuthor
#3 media-browser-screen.jpg7.43 KBambientdrup

Comments

ParisLiakos’s picture

In function media_browser_plus_move_file($tid, $media, $replace = FILE_EXISTS_RENAME) {

replace FILE_EXISTS_RENAME with FILE_EXISTS_REPLACE.

i dont think there is anything in the roadmap:P

ambientdrup’s picture

This works. However one new issue. Once I replace the $replace value with _REPLACE, then when I go ahead and test it and upload a replacement file; the file does upload but the actual uploader screen/modal window does not auto refresh back to the Files screen once the upload is completed. It just shows a horizontal line across the screen/modal.

It does continue to work without issue when the value is _RENAME.

To get it to kick back to the Files main browser screen I need to do a full browser refresh. The file does upload and replace the existing file correctly however. So that's working.

I'm attaching a screenshot of the new behavior - looks like something is not firing correctly in the jQuery or javascript? Any suggestions?

-Trevor

ambientdrup’s picture

StatusFileSize
new7.43 KB

Here's the screenshot.

ambientdrup’s picture

Not totally sure if this is related but there are log entries firing at the same time as I'm running these replacement files:

1) Location & Referrer:

/media/browser?render=media-popup&types=&activePlugins=&disabledPlugins%5B%5D=library&multiselect=true&plugins=undefined

2) The file public://screen2.jpg was not deleted, because it does not exist.

3) The file public://ctools/css was not deleted, because it does not exist.

-Trevor

ParisLiakos’s picture

can you check for any javascript errors?

ambientdrup’s picture

Tons of errors being reported. For example, getting this:

Warning: Use of attributes' nodeValue attribute is deprecated. Use value instead.
Source File: http://localhost/site/admin/content?render=overlay
Line: 0

and this ...

Warning: Unknown property 'zoom'. Declaration dropped.
Source File: http://localhost/site/misc/ui/jquery.ui.dialog.css?m0itfj
Line: 17

Amongst others.

-Trevor

ambientdrup’s picture

Another issue here - the thumbnail image of the replaced file in the "Thumbnails" view screen still shows the existing image (before the replacement was swapped in). If you actually preview or view the image it shows the correct full scale replaced version, but the thumbnail is not updating.

I think this still needs more work - obviously it's buggy by just replacing the _RENAME with _REPLACE.

-Trevor

salvis’s picture

Issue summary: View changes
Status: Active » Closed (outdated)