Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've been having issues with this plugin. What it does is that as long as an image in your blog post has an "id", then every commenter can hover over the image and leave a note directly in the image/photo. It is syncronized with the WP comment system and so the image/phot note will appear as comment with a small thumbnail of the picture one has commented on.

This seems to be the only up to date plugin of its kind. I really need this function for my blog, but I would never be able to write a plugin like that myself, so I need to get this to work somehow. The original idea for the plugin came from here.

Here's an example post where you can hover over the images and leave notes on them. It works perfectly fine, however when I try to leave a comment to the post (without leaving an image note, so we're talking about a normal comment) while I'm not logged in, I get the following error message:

noted on #img-46

Warning: Cannot modify header information - headers already sent by (output started at /hermes/bosweb25a/b155/ipg.zoomingjapancom/wp-content/plugins/demon-image-annotation/imageannotation.php:178) in /hermes/bosweb25a/b155/ipg.zoomingjapancom/wp-comments-post.php on line 95

Warning: Cannot modify header information - headers already sent by (output started at /hermes/bosweb25a/b155/ipg.zoomingjapancom/wp-content/plugins/demon-image-annotation/imageannotation.php:178) in /hermes/bosweb25a/b155/ipg.zoomingjapancom/wp-comments-post.php on line 96

Warning: Cannot modify header information - headers already sent by (output started at /her.../wp-content/plugins/demon-image-annotation/imageannotation.php:178) in /her.../wp-comments-post.php on line 97

Warning: Cannot modify header information - headers already sent by (output started at /her.../wp-content/plugins/demon-image-annotation/imageannotation.php:178) in /her.../wp-includes/pluggable.php on line 934

Here's the plugins php code that is causing the problem: @Pastebin It might have something to do with the "echo" command in line 178. I tried "return" instead, but then the thumbnail of the image you commented on is not shown in the comment anymore. There must be another way.

I've already tried a few things and it seems that other people don't have the same problem with the plugin, so I was wondering if it's actually the plugin or something else that's causing this problem.

This is quite tough, but I hope somebody here can help me figure it out.

EDIT: As for now I'm trying to call the javascript in a better way!

So what looks like this in the plugin's php file:

echo "<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js' type='text/javascript'></script>\n";
echo "<script type='text/javascript' src='". $plugindir ."/js/jquery.annotate.js'></script>\n";
echo "<script type='text/javascript' src='". $plugindir ."/js/jquery-ui-1.7.1.js'></script>\n";
echo "<script type='text/javascript' src='". $plugindir ."/js/jquery.md5.js'></script>\n";

Should look somehow like this: (this is a shortened version)

function add_my_javascripts() {
    /* If this is the admin area of WordPress, don't do anything */
    if( is_admin() )
        return;

    /* Register all of our scripts */

    wp_register_script('jquery-ui-perso', get_template_directory_uri() . '/js/jquery-ui-personalized-1.5.2.packed.js', array('jquery', 'tab-renamer'));
    wp_register_script('md5', 'http://zoomingjapan.com/wp-content/plugins/demon-image-annotation/js/jquery.md5.js', array('jquery', 'jquery-ui-perso'));
    wp_register_script('jquery.annotate', 'http://zoomingjapan.com/wp-content/plugins/demon-image-annotation/js/jquery.annotate.js', array('jquery', 'jquery-ui-perso', 'md5'));

    /* Enqueue the ones that need to be enqueued */

   wp_enqueue_script('jquery.annotate');


}
add_action('wp_enqueue_scripts', 'add_my_javascripts');

Unfortunately this doesn't work, so I think I'm calling it wrong. Maybe I got the dependencies wrong? I don't een know what that md5.js is supposed to do, so I'm not sure. Anybody knows?

EDIT: I've marked the only answer as accepted answer, however there's still no solution to this and I'm not the only one struggling with this plugin.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

The problem is that the plugin is trying to echo data (re-sending the headers) after they have been sent.

Here is line 178 of the plugin echo "<div id=\"comment-".$str."\"><a href='#".$str."'>noted on #".$imgIDNow."</a></div>";

I would need more information on which page the plugin was failing on. What the plugin does, what you are trying to do to be able to help you further.

share|improve this answer
1  
I think the issue is the opposite, something else is trying to send headers, but this plugin has already sent content to the browser. A cursory glance at the code shows JavaScript is handled incorrectly, I'd question the overall quality of this plugin. –  Milo Sep 24 '11 at 20:36
    
@BandonRandon: Thank you very much for your answer. That's exactly what I wrote in my post, that's why I tried to exchange the "echo" with "return", but it didn't work. I've updated my question with a lot more information now, so if you have time please have a look at it :) Thank you very much!! –  japanworm Sep 25 '11 at 2:27
    
@Milo: Well, I need this function for my blog and because there's no way that I can write a plugin like that myself, I need to get this to work somehow :/ ... You think I have to modify s.th. else instead of the plugin then? –  japanworm Sep 25 '11 at 2:27
    
@Milo That's what I ment I just read the error backwards :) –  BandonRandon Sep 25 '11 at 7:14
    
@japanworm what happens if you comment out lines 168-195 the problem is that it is trying to treat all comments like annotations and you need a way to tell them apart I just haven't figured it out yet. Also it seems the aurthor put out an update 9 days ago is that the version you're using? –  BandonRandon Sep 25 '11 at 7:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.