Support » Plugin: NextGEN Gallery - WordPress Gallery Plugin » [Plugin: NextGEN Gallery] NGG and Featured Image issue

  • After fighting with the developer of Query Posts widget, that, via the Get The Image plugin, wasn’t showing featured images set using NGG, I’ve realized that the issue is in NGG.

    Quoting Justing (the developer of both widget and plugin):

    I just wanted to run a test with NGG since you mentioned it. I uploaded the plugin, created a gallery, and set the featured image from that gallery for the post. It didn’t work.

    This left me wondering why it wasn’t working. So, I went to my database to check the post meta for _thumbnail_id (this is how WP saves thumbnails). See, the thumbnail ID is supposed to be saved as an integer (e.g., 1, 2, 3, 4). However, NGG saved this as ngg-1. This is just bad practice altogether.

    So, when something like get_the_image() (or any plugin for that matter) asks for the thumbnail ID via the WordPress function get_post_thumbnail_id(), NGG borks the entire thing.

    He’s right indeed!

    Why NGG uses a string in a custom field that is supposed to contains an int?

    Ok, the_post_thumbnail() still get the right image, but probably this is because NGG is hooking or filtering this function: I’ve no clue actually.

    However, the way NGG works, is not good and need to be solved from my point of view.


Viewing 15 replies - 1 through 15 (of 17 total)
  • If it’s good or not… how should I use “featured image” when i just set a int as $post_thumbnail_id ? Give me a better solution to determine that the image should taken from NGG instead the media lib and I will do so…

    A second custom field?

    The fact is that this way is too invasive: the moment I disable NGG for any reason, all featured images will stop working.

    It has always been my opinion that NGG must work on the top of the standard WP media manager and not as a completely separated environment: this would solve most of the compatibility issues.

    Unfortunately, I’ve never found anything like NGG and only today I’ve realized about this flaw that is going to be quite an issue each time the mentioned plugins get updated (I’ve hacked them in order to work).

    Since NGG takes over the standard WP function that retrieve featured images, I think that it could set and read a second custom field, that works as a flag, in order to know if is an NGG image or not.

    Even better, I repeat, would be if NGG could work along the default media manager.

    It’s not invasive or a flaw IMHO, it’s juts an idea to make use of post-thumbnails without adding new code for people which didn’t have any clue about PHP & themes (which could be done as well).

    Just look into the lib I created:

    Modify the function, hooks & filter in the way you like it and report back a better solution. I’m always open for improvements

    Hello – any further development on a solution to this conflict? I’m trying to avoid uploading 2 versions of each image.

    just found out that becuase of this issue the thumbnails that should be set for preview are not being used. instead the full sized images are being using increasing load time, lowering rendering time, and as a result… lower page ranking for the entire site.

    This is a serious issue.

    I do not know what to offer as an alternative.

    Is there a way to fix this?

    Modify the function, hooks & filter in the way you like it and report back a better solution. I’m always open for improvements

    Yea… sure I’ll grow a brain that knows code overnight, and perfect your plugin.

    Whatever, the other thread stated you had no interest in unfudging this.

    Seeing as its been six months… I’d say they’re true.

    And we’re stuck with it because if we disable your plugin there’s no thumbnails or anything else on record.

    Have a good weekend Alex. Enjoy our pain.

    The featured image is full of special race condition, which I didn’t implement, true that you can’t use it in your case. Sorry for that, if there is some time I will look into that.

    Thanks Alex,

    That you have considered working on this is very much appreciated. I’m not a strong coder so I will confer with the person that discovered the issue and see if they have some suggestions.

    Justin Tadlock seems to have a decent idea for a solution. Basically create a custom field for nextgen and copy the IDs to there. He would them release a script to fix the old IDs so that we are not using the large & medium sized images as thumbnails. Thereby repairing the damage done to page rank, load time, and search engine ranking.

    From Justin Tadlock whom discovered the ‘bug’ via this thread:

    There’s really not much I can do from this end. I could give you the code to undo the ngg-1 problem mentioned in my explanation about the plugin issues. However, that would break the plugin’s functionality.

    The only viable solution is for the plugin to create and use its own custom field, something like _ngg_thumbnail_id, instead of overwriting the WordPress _thumbnail_id. This is something the plugin developer has to do.

    Alex this may be helpful as well as it technically details what is going on with Nextgen.

    This is becoming more a problem everyday. Alex, can you take any steps to fix this?

    This is causing the pagespeed score o sites google indexes to be low. Because instead of using thumbnails the engines are seeing full sized images in the thumbnail area…and that is driving up heavy and long loadtimes for sites with a lot of content that use Nextgen.

    Please help us. This issue is native to the design of nextgen.


    I take a look into this, but this needs more rework for me, so I will need to rethink my main implementation. This will take some time…

    Thank you Alex!

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘[Plugin: NextGEN Gallery] NGG and Featured Image issue’ is closed to new replies.