Skip to content
This repository has been archived by the owner on Apr 2, 2020. It is now read-only.

Explore creating an image shortcode with an external image #30

Open
goldenapples opened this issue May 7, 2015 · 3 comments
Open

Explore creating an image shortcode with an external image #30

goldenapples opened this issue May 7, 2015 · 3 comments

Comments

@goldenapples
Copy link
Contributor

In a few places, the code is written as though its possible to create a shortcode using an external image rather than an attachment post. This functionality is not built out and poses a lot of problems, though.

We should scope out whether this is a reasonable/desirable feature and either build it out some more or remove the stub code which was written with that possibility in mind.

I suspect that this is not a feature worth building, as WP's media sideloader is already a pretty good experience.

@vralle
Copy link

vralle commented Nov 23, 2015

https://gist.github.com/vralle/be30857d8c1f3bd55efa
Insert external images as Shortcode by WP Media. WP4.4b4, work!)
But shortcode UI need more change

@goldenapples
Copy link
Contributor Author

A few thoughts about this gist: ^

This is just inserting all attributes from the <img> tag onto the [img] shortcode. That much makes some sense. The bigger question as I see it is how to represent that in the UI.

Right now, the UI has an attachment picker attribute defined for attachment, but no field defined for src. So you can insert a shortcode like [img src="http://src.url/filename.ext"], and it'll display fine with the callback, but if you try to edit it, the field for src won't be visible. Does it make sense to expose that field in the UI, and if so, when? Should we show a field for src unless there's an attachment selected?

@vralle
Copy link

vralle commented Nov 23, 2015

The initial interface should meet the two fields. This attachment and src. When we select one, js can open only the required fields. It is not difficult. The difficulties begin, if we do not lose the opportunity WP Media. In this case, we would have to reinvent the wheel, catching up with WP Media. On the other hand, if we have a shortcode like in other places, we have to do something with it.

The solution is to reverse [img src = "link"] to html via the filter 'content_edit_pre'. In this case, we can use the WP editor. When save the entry, we can convert html to shortcode again

PS. I apologize if my English is not good.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants