There are 2 versions of this plugin available, differing in features.
Premium Version
If you would like to give your visitor the ability to upload images along with their comment, I have developed a separate WordPress plugin that accomplishes that.
This plugin is now available for purchase online. It costs $97 and will be sent to you electronically immediately after you purchase it.
Why isn’t it free? It is a highly customized solution. It took a long time to develop and you’re also paying for my time.
Free Version
This will allow your visitors to embed an image that is already hosted somewhere on the web. All they have to do is add the link to the image and it will appear inline with their comment.
Download
Installation Instructions
- Download
- Unzip
- Upload the plugin file to the wp-content/plugins of your website
- Activate via the Plugins page of the WordPress administration
Usage
A link should appear below the comment form, allowing the users to link to an image. Once they input the URL for the image and click OK, the appropriate markup will be added to their comment.
Donate
Do you find this plugin useful? If so, please consider donating to show your appreciation. Your contribution goes to make sure I can maintain and develop more projects. I will greatly appreciate your generosity. Thank you! 
Try out a demo
Three possible minor improvements to your plugin:
(a) instead of the “you can add images to your comment” text appearing after the “submit” button and the “notify me of responses to this post” checkbox, and in my case also after the cocomment ‘cocobar’ which appears directly under the textarea,
can yours be inserted directly under the “code allowed” line, above the textarea?
(b) enable multiple image insertion “one image per line”, so if I have a collection I can copy and paste them all in one step
(c) users can already right-click images and select “copy link location” and then paste that into the comment plugin, but for most people that requires too many clicks and scrolls. In Excel and OpenOffice, there is “Paste Special” which allows you to choose if you want to paste the text or the link (…). Can something similar be done on the web?
Jonathon,
Thanks for the comment. You’ve got some good ideas…
(a) Not all WordPress themes use the “allowed tags” code above the comment box. It’s something that’s hardcoded into each template. You could hard code the text into that place, though, so the “add image” link is above the comment box.
(b) It’s possible but probably not useful for many people. It’s a good idea but I’ll leave it out of any future releases.
(c) I don’t think so, no. The comment form is just a simple text input. It can’t be used like an advanced text editor.
Thanks!
hey, great plugin!
Im new to php and was wondering which php file calls the embed_image_instructions function? I wanna put the upload image text above the comment box instaed of below it.
Thx
ah i found it
in the comment.php for my theme it calls
ID); ?>
php do_action(‘comment_form’, $post->ID);
Chris,
That’s the one! If you want it above the comment box, you’ll have to manually edit the theme. There is no WordPress ‘hook’ that allows a plugin to place it there.
Thanks!
Love your plugin!
Had a thought though. Instead of putting the image right in the comment, what about adding a link that would show the image in a lightbox? I have been trying to get it to work, but without success. The link would have to look like this below for it to work.
<a href=”URL to image” rel=”lightwindow”>Link Name</a>
Any thoughts as to how to get you script to put the above out.
You would also need the ms_lightwindow plugin for this to work.
Thanks for your thoughts
Paul,
That’s a very good idea! I’ve just recently become aware of lightbox and would love to use it in this plugin.
I will add it to my list of things to do and make it an option in the next release. I will work on it a bit this weekend and email you my results.
Thanks!
Here is a one of the lightbox’s out there.
http://www.stickmanlabs.com/lightwindow/
This site has awesome instructions as well as how-to’s
This lightbox can do much more than images. Can load just about anything you can think of, much better than most of them out there.
I look forward to your results. Thanks, Paul
Paul,
All that’s necessary to make lightbox (or other) work is the following:
Click here for the instructions!
Good luck and let me know if it works!
That did not seem to work. Although that might be some of the script that needs to be added. I think the following line needs to change as well.
document.getElementById(‘comment’).value = document.getElementById(‘comment’).value + ‘[img]‘ + URL + ‘[/img]‘;
The script is adding the image to the comment box with the [img] tag instead of using the link tag that it needs. I would imagine that the img + URL + img would need to look like the link populated in the comment box.
I could be way off but when I tried the new scripted, all I got was a fatal error.
By the way, I think we are neighbors…I live in Canton, MI.
Paul,
My mistake. I forgot to escape 2 characters in my code. This one will work (I tested to make sure!).
http://wordpress.pastebin.com/f47dc089b
This assumes you have lightbox or lightwindow already setup on your site. Change “lightbox” to whatever the image script wants. You don’t have to change anything else. The PHP code parses the [img] tags and will return the link with the rel attribute.
P.S. Hey! I was just in Canton, too. Did some shopping at IKEA.
Worked like a charm. I had to change the “rel” to class to get it to work with lightwindow. Thanks for all your hard work. Looks great and works great.
Paul
Hi Trevor,
I just enabled this plugin on a Wordpress blog, and the link didn’t show below the comments block.
Is there something I can check on my blog to make sure that this is displayed?
I think it has something to do with my theme, as when I switch back to the default theme it works fine. What would I have to edit in my theme to have this displayed?
Antonio,
You can check to see if this piece of code exists in your comments.php file of your theme:
< ?php do_action('comment_form', $post->ID); ?>** Make sure there’s no space between that greater than sign and the question mark at the beginning.
If it doesn’t, just go ahead and add it wherever you want the link to appear.
Thanks Trevor!
I think the comment section is working, but I don’t think the actual code is being embedded into the head. Is there another function that should be called ti embed the JavaScript into the head?
Antonio,
There is no code to add to the head. I modified my own plugin to work with lightbox. That might be what you mean.
The downloadable version of this plugin will insert the image directly into the comment so it’s visible inline.
Well,
When I try to add an image, the link isn’t being embedded into the comment box. I’m not sure why
Antonio,
It is likely because of your theme. Try changing to the default theme to see if it works.
I would love to see the ability to upload an images as well as just using a link
Hi Trevor
Is your plugin still 97 Dollars???
Greets
hi there,
I have added your plugin and the following code but nothing seems to work once i enter the image URL..
ID); ?>
(without the space)
I have it on http://thepetbarn.ignitionmedia.info/pet-stories. Can you please assist as to what I have done wrong or need to change.
thanks very much
Futher to my comment above, I have my comments function on a page, not post. Will this effect it?
I changed my theme to the default but then there was no contact form on this page at all.??
please help!
Raffy,
Yes, the plugin is still available. I will be setting up a shopping cart shortly so that it can be easily purchased. Thanks.
Nicole,
Your in your website needs an “id=’comment’” in order for it to work. The fix is quite simple. Just open up your theme’s comments.php, find:
<textarea name=”comment” cols=”50%” rows=”8″>
and replace with:
<textarea name=”comment” id=”comment” cols=”50%” rows=”8″>
Good luck!
P.S. I really like your site!
Trevor – are there any reference sites showing where the paid for version is installed? Could be just the thing for a project I’m working on.
Hi, maybe I’m stupid, but could someone please advise how I “install” the plugin? My site is hosted at Wordpress, so I don’t have any installation files.
Thanks
Sean
Sean, The plugin is only for self-hosted versions of WordPress. You can’t use it on WordPress.com.
-Trevor
hi there,anybody who knows how can i have(upload and download images)on my website.like visitors can share there photo and download some images from my site.www.nichportrait.com.need some help thnx
Well some like this way, Buy I think you should consider the another side of the toppic too. Thanks
test post please delete if you like
Looking at the previous post, looks like it imbeds the link to the imag, not the image.
Matt,
I changed it so that it only provides a link. It can be easily configured to show the actual image, too.
Trevor
I need image upload through image search
“I changed it so that it only provides a link. It can be easily configured to show the actual image, too.”
Hello, I’m trying to get this to work, I changed the line with this one:
$content = preg_replace(‘/\[img=?\]*(.*?)(\[\/img)?\]/e’, ‘”” . basename(“$1″) . “” . basename(“$1″) . ““‘, $content);
It is showing the actual picture and the lightbox effect works but there are also 2 hyperlinks, 1 above and 1 below the picture. I’m don’t understand php very well so could you please help me with this? Thanks
Roland,
I sent you an email hopefully answering your question.
I am interested in the concept…but would thought that you would provide a model/example of the “picture in the comment”. If you could do this and let me know, I may be one step closer to a purchase.
is there a way to limit the size of images posted in comments?
Hi Trevor,
Nice plugin. But I have the same question as Michael:
“Michael
is there a way to limit the size of images posted in comments?”
Users can upload pictures of any sizes, which is not good. Is it anything I can do to limit the size?
Thank you.
Hi Trevor again,
Thank you for your reply.
I am not a pro, please let me know what should I change in wp-comment-images.php to resize the pictures to certain size.
Thank you.
On your free plugin it could be great to show the ‘publish image link’ only to subscribed or admin users…
Is it possible?
Hi Trevor. I just purchased your quite nifty comment image uploader script and wanted to report a weird quirk with it. The $upload_path variable was not able to properly define itself on my host. It kept inserting an erroneous portion of the server path into itself that didn’t belong. It repeated the beginning /usr/ portion of my server path after the domain name. So instead of…
/usr/accountname/domainname.com/wp-admin/uploads
I was instead getting the incorrect…
/usr/accountname/domainname.com/usr/wp-admin/uploads
…for some odd reason. I was able to rectify this by hacking your code a little (just defined it as /wp-admin/uploads which worked fine), but it is something that you might want to include in documentation for others just in case.
Dameian,
Thank you very much for pointing that out. I will see if I can’t change the code to make it more universal.
Enjoy the plugin and let me know if there’s anything else.
Thanks,
Trevor
Hi Trevor,
I emailed you this question but thought it might be better for it to be public. Are there any security issues/risks with this plugin (i.e. someone uploading a virus)?
thanks!
ari
Ari,
Great question. The plugin takes precautions to make sure that the uploaded content is indeed an image. Security is always a primary concern whenever I am developing a plugin. I made sure that this plugin does not open up your blog to any harmful exploits.
Thanks for the question,
Trevor
Спасибо за статью.. Актуально мне сейчас.. Взяла себе еще перечитать.
I don’t want to write about this plugin but rather about something I saw in source code of this page.
You use jQuery from their site, but instead you should use it from Google AJAX Libraries API, as it is recommended (and used) even by JQuery (also see for example latest release, where they also recommended this)). By this you are making bill to them, instead of free solution from Google.
And you shouldn’t use packed version, but instead minified one, see why.
Cheers!
(p.s. install Subscribe to Comments plugin for easier comments replis tracking
)
Milan,
Thanks for the info. Those were good reads. I have changed the code on my site. Thanks for bringing that to my attention. I’ll make sure I use it correctly on other sites, too.
Thanks!
Hello!
Very Interesting post! Thank you for such interesting resource!
PS: Sorry for my bad english, I’v just started to learn this language
See you!
Your, Raiul Baztepo
As others have stated before, is there any way to limit the size of the pictures? or show just the thumbnails of the picture?
I am using the free version. Thanks.
Hi Andy,
That is not currently an option in the free version. Although it is on my list for the next version!
Thanks!
Trevor
Hello Trevor,
New to wordpress and PHP, but I have a question about your free version of your plugin. Can I have people add pictures to their comments to my blog, or only pictures VIA url?
Thanks in advance,
Jim
Hi Jim,
With the free version, your visitors will be able to add an image that is already hosted somewhere on the web. All they do is insert the URL where that image is located.
With the premium version, they would be able to add an image from their own computer.
Hope this helps,
Thanks!
Thanks, this looks very useful! I’ve downloaded the free version, and will be testing it. =)
Great plugin!
I got the paid version and it ROCK’S, the setup is a little bit on the advanced side (for a semi noob like me), but Trevor stuck with me untill i got it working just right.
Thank’s Trevor, I wish Dell, Compaq, HP, Gateway, etc… had customer support this good.
Check out my site and see it working @ Zacoalconet
Is it possible to turn off the light-boxing?
Thanks,
Tom
Do you have any experience with this working with the thesis theme? I just want to make sure it is good with wordpress 2.8.4 and thesis 5.1 before I buy it.
Thanks
Trevor,
Can your paid version deal with non-image uploads, such as word files? I am considering purchasing but need to know if this is possible as my site requires the option to upload different file formats, particularly word or pdf files?
thks
sam
Still waiting on an answer for a question that was asked in December 2008:
Is there a way to limit the size of uploaded images?
Even something as simple as a css modification?
Tom, Yes the lightbox effect can be disabled.
Matt, Yes everything should work well with the Thesis theme.
Sam,
By default, the plugin only accepts image files. Please contact me directly to discuss allowing other file types since it will require minor customizations.
Eric,
The plugin resizes all uploaded images so size should not be a problem. If you still require size restrictions, please contact me directly so I can try to help you out.
I resize all my Images via CSS, it’s the simplest way and you can separately choose which size the have if you setup rules for each the blog page and the comment page.
Here’s the CSS you need:
max-width: 515px;
width: expression(this.width > 515 ? 515: true);
__________________________________________________________
I really hope Trevor comes up with a setting/setup page to deactive certain parts of the plugin.
• I don’t need the resizing via phpthumb
• I don’t want a separate Lightbox just for my comments (setting up my choice of Lightbox globally -not just for comments- seems more convenient to me)
• But what I obviously like to keep is are the “rel=”lightbox” tags, so that I can use/customize them wo work with other lightboxes (At the moment I get two lightboxes displayed in the comments)
Anyway nice plug-in… I just need some advise how to tweak it.
Cheers,
Patrick
Trevor,
I’m using your plugin at http://pricelessimprinters.com/blog and I wanted to know if there is a way to control the size of the image within the code. I tested it and linked to a large image that was HUGE. Thanks.
Nevermind, I found this line in the source and added the “width” parameter. Thanks for the plugin.
[code]
// Accepts 2 formats:
// 1.) [img]http://image.gif[/img]
// 2.) [img=http://image.gif]
function embed_images($content) {
$content = preg_replace('/\[img=?\]*(.*?)(\[\/img)?\]/e', '""', $content);
return $content;
}
[/code]
Hi Trevor,
I just upgraded that plugin to 1.4 and it didn’t show in my plugin page and of course it was disappear from my wordpress.
I tried to erase it and install again.
When I tried to activate it, there is an error, it said something like “it has no valid header”.
Please advise, thanks.
Hey there Trevor. This plugin has just broken on our WP 2.8.6 install. First it just disappeared and all the embedded links became non-functioning, now I get this error when I try to reinstall it:
“The plugin does not have a valid header.”
Any ideas? Thanks!
@Val & @Trollcats,
Thank you for reporting the issue. I just finished taking a look.
I upgraded the plugin to version 1.5. You can download it here: http://wordpress.org/extend/plugins/wordpress-comment-images/
Everything should be back to working. Sorry for the inconvenience!
I was pleased to find your plugin but unfortunately it’s not functioning properly on my site. The link appears on the comment box, when clicked it brings up the box to enter a URL but when clicking OK, the box disappears and no image appears in the comment,
Appreciate any suggestions on how I might resolve this.
Hi Chris,
Does anything show up in the comment box after entering the image URL? It should add “[img]http://…image.jpg[/img].
Trevor,
I updated the theme, put the code in the same way as before and now it works. Let me say that your plugin is very cool! I didn’t even know about the lightbox feature when my client purchased it. VERY COOL. Thank you!