This project is read-only.

Can Image in Media Library Be Changed without FTP / Deprecated Media Manager

Topics: Core, General
Sep 21, 2013 at 9:52 PM
I am moving away from the old Media Manager in favor of the Media Library and have one issue I cannot figure out, how can I change the physical image without breaking the Media Library Picker field?

Example: I have an image of a dog connected to a couple Media Library Pickers and want to update my dog image. Right now the only way I know how is to FTP up a new dog image with the exact same file name OR use the old Media Manager, delete the image, and re-upload one with the same name.

In my mind, for the new Media Library tool to be complete it needs the way to change images without making a new media content item (i.e. updating an existing media content item. Is there a way? If not, I will look to build/add one.
Sep 22, 2013 at 3:00 AM
Currently, you can't, and that's clearly an issue.

FTP by the way should be avoided for uploading images now.
Sep 24, 2013 at 2:36 AM
I have opened an issue here:

I have modified the code and have it working for images. I will finish up OEmbed and WebSearch and post the results at the above link so the changes can be incorporated into core.
Sep 24, 2013 at 3:07 AM
I do have one outstanding question if anyone cares to jump in. What should happen if someone switches from an image to an oEmbed (external source). This is actually a different content type so that would force the creation of a new Content Item. Should we:
  • Not allow this to happen
  • Allow this to happen, create the new content item, but don't delete the old content item
  • Allow this to happen, create the new content item, update all the media library picker from old to new content item, and delete the old content item
  • Allow this to happen, create the new content item, update all the media library picker from old to new content item, but don't delete the old content item
I am leaning towards the last option above, hope this makes sense and look forward to feedback.
Sep 24, 2013 at 3:22 AM
What do you mean by "switch" in this context?
Sep 24, 2013 at 3:42 AM
Switch as in you start with your media being an image, then, while updating you choose a YouTube video to embed.

Sep 24, 2013 at 3:52 AM
How would that happen in terms of UX?
Sep 24, 2013 at 1:57 PM
Here is what I have currently.
  1. When you select your image you would press "Edit" (nothing changed here):
  2. I have added a new link (styled as button) for Updating the Media Source:
  3. This hyperlink passes the contentId (of the current media item) and the returnUrl over to the native import process (as I see no sense in creating a new interface for Edit):
  4. From here, the user can choose their media as they normally do, I have just updated the controllers to handle the returning of a contentId. With this approach they are only editing one at a time (whether for good or bad) so I only accept the first uploaded item. Assuming they choose the same type (i.e. Image to replace Image or OEmbed to replace OEmbed) then it is easy to handle, mainly just updating the source path. The only question in my mind is defined above, what to do when the content item is an Image and they choose an OEmbed
Hope the images help illustrate how I currently have this working and look forward to thoughts.
Sep 24, 2013 at 5:28 PM
Thanks, that's very clear. I think we should disallow that. If you want to update to a completely different kind of media, you should create a new one.
Sep 24, 2013 at 8:28 PM
Thanks for the input, it certainly makes the logic much easier to follow. I have just finished coding everything and will now need to test it out. What is the best way to have this committed for others to see it? I have too many files edited to make it easy to just pass along the files (could be done). I saw some times others have used a git patch, is that a good technique?
Sep 24, 2013 at 9:31 PM
So testing has revealed one fact, I am trying to put up notifications to the user from within OEmbedController or WebSearchController, etc using to let them know if they did something wrong:

Services.Notifier.Add(NotifyType.Error, T("Updated media must be of the same type. Your new media has not been added."));

However, none of these persist (I believe since they are embedded html pages within the Import page. Before expanding the viewmodel to pass messages back to the view, do you know if there is a native way to pass the service notifications to the current window without doing that?
Sep 25, 2013 at 12:12 AM
Create a fork. It will then be easy to submit this as a pull request.

Not sure how to deal with your notification problem. Seems like you'll have to find a way to communicate client-side with the parent frame.
Sep 25, 2013 at 5:14 PM
I have handled the notifications and feel the fixes are ready for integration.

First time I did a fork and pull request so hope it came out right:

Thanks for the help Bertrand.
Sep 25, 2013 at 7:44 PM
Congrats then