Embed Comment Images in WordPress
WordPress allows the use of HTML img tag in the comments, so the images are shown directly if wrapped with it, but most of the people who visit our blogs do not know how to use HTML tags. After unsuccessfully searching for an instant solution, I decided to build a plugin that exactly do that.
This plugin is simple. It uses preg_replace to detect direct image links in comments and wraps those with the img HTML tag. On top of it, you can specify the width of your comment so it creates a container and then fits the image into it. It does not resize images it just puts images of any size into the specified container. This is good because nothing is stored on your server, but bad because people can link images of virtually any size which will slow the loading of your page for your visitors.
I am planning in the next version to detect the size of the image on the given link and if it is over X megabytes and x*y pixels it skips the wrapping image in the IMG tag.
Currently, this plugin embeds only images with .jpg, .png, and .gif extensions, but I am planing to make an interface so you can specify which image types should be embeddable.
You can download the plugin from WordPress.org or here:
Embed Comment Images DEMO
You can use this post as a testing demo. Just copy/paste the image link directly into the comment field.
If you want to embed video content URLs in the comments, you can do so by using oEmbed plugin.
i malo teksta
Hello, I installed this and imgur links dont work.
“>” alt=”” width=”500″ height=”304″ />
It works with imgur links. Above image is from imgur and it shows just fine.
Hello, your update is great, but the images don’t show up in comment widgets or site wide activity (buddypress). Any plans for an update or any ideas on how I could implement that functionality? Thank you!
How to create a photo upload button here?
Oh MAN – wish I’d known plugins are only available to PAID WordPress users. Sure would like to use this (FTP not an option for upload). Thanks anyway.
WordPress is free, so as this plugin.
Comments are closed.