Skip to content
This repository has been archived by the owner on Aug 24, 2018. It is now read-only.

Allow adding media by external URL #9

Closed
obenland opened this issue Mar 9, 2017 · 8 comments
Closed

Allow adding media by external URL #9

obenland opened this issue Mar 9, 2017 · 8 comments

Comments

@obenland
Copy link
Contributor

obenland commented Mar 9, 2017

Add the menu so media can be added via URL.

See https://core.trac.wordpress.org/ticket/32417#comment:69

@obenland
Copy link
Contributor Author

obenland commented Mar 9, 2017

This is not a PR because I don't know enough about the media modal API (yet) to make it happen

@westonruter westonruter changed the title Add menu in media modal Allow adding media by external URL Mar 16, 2017
@westonruter
Copy link
Contributor

Essentially we need to add the “Insert from URL” tab:

image

@westonruter
Copy link
Contributor

Some todos/questions I see here:

  • We need to open the media selection frame with the new “Insert from URL” tab shown, in addition to adding a “Insert MediaImage” tab for the media library selection frame.
  • When an external image has been selected, the Edit Image button should open to the “Insert from URL” view with the url. I don't think the edit image modal shown for attachments will work.
  • While the media manager is anticipating that you can paste any media URL in, we need to constrain it specifically for images.
  • An image added by external URL will result in the widget instance having an attachment_id of 0 and yet a url pointing to the external image.
  • The image preview JS template in \WP_Widget_Image::render_control_template_scripts() needs to account for the case when url is populated while attachment_id is 0.
  • Similarly, the \WP_Widget_Image::render_media() method needs to be updated to account for when $instance['attachment_id'] is empty while $instance['url'] is populated.

@obenland
Copy link
Contributor Author

Great summary, thanks for that!

in addition to adding a “Insert MediaImage” tab for the media library selection frame.

I think it's fine for it to remain to say "Insert Media", we can still filter the actual library.

I don't think the edit image modal shown for attachments will work.

It looks like the editor uses the edit image modal, it just doesn't show size or image editing options and you can't link it to its attachment page. I wonder if the modal handles that case out of the box based on whether an attachment id is provided or not? Worth trying out.

@adamsilverstein
Copy link

I'm going to take a look at this issue

@adamsilverstein
Copy link

I started working on this in https://github.com/xwp/wp-core-media-widgets/compare/master...adamsilverstein:issue-9?expand=1 and have the insert from url part of the modal showing so far.

Next, I will work on handling the insert button, the templating and also what happens when you re-open the dialog as Weston outlined above.

@adamsilverstein
Copy link

First pass for this issue in #46. Appreciate some feedback @melchoyce, @obenland & @westonruter!

@westonruter
Copy link
Contributor

Fixed by #46.

@westonruter westonruter moved this from Todo to Done in Image Widget (#39993) Apr 21, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

3 participants