I'm looking to adapt an existing forum-like plugin which has no facility for attaching media.
The plugin works as a Custom Post Type, so it would be as "simple" as attaching an image to a post.
I am only concerned about attaching images rather than any file type, but the plugin does use wp_editor
and as such the solution should in some way integrate with that. I'm not overly fussed about creating a tinyMCE button, as long as the solution is capable of inserting a thumbnail of the image into the tinyMCE textarea.
Please note, I am referring to the front-end of my website rather than the admin area.
In an absolutely ideal situation, I would like this scenario to occur:
- User clicks "Ask a question"
- Use enters their post details
- User clicks a button on the tinyMCE interface which, similar to StackExchange, asks the user to upload a file.
- System then inserts the correctly-sized thumbnail into the tinyMCE textarea, having crunched the file into this thumbnail size
- Clicking this image should offer the same functionality as an image attachment in a Post
- User can then click again to insert a new image
- User can also delete the image from the tinyMCE textarea as needed
However, I am happy for the tinyMCE button to be peripheral - if a "file upload" box is significantly easier, that's fine.
I came across this link but I'm always apprehensive about reading WordPress articles on t'interwebs as I'm never too sure of how secure they are, nor am I a php security expert by any stretch of the imagination.
Thanks in advance,
wp_editor()
function, why not just use the media upload thickbox thats included in it? I haven't used thewp_editor
on the front end, but there are some people who have successfully gotten it working with image uploads, see here, for example... – goldenapples Feb 14 '12 at 18:59wp_editor
's media uploads would give users of any level access to my entire media library? I wouldn't want that to be the case at all - just for them to upload their own. – dunc Feb 14 '12 at 19:49media-upload.php
source in a while, but I'm pretty sure theres a filter on media_upload_tabs where you can disable the "Media Library" tab. I'll look at it and see... – goldenapples Feb 14 '12 at 22:28