NextGen Plugin Issue Resolved for Bedrock/Sage

If images aren’t showing up for your galleries and the img src is something like “wp/app/themes/sage/gallery/blah.png” then it looks like NextGen is using WP_HOME to build the img url. Simply adding “…” to the path before “app/themes/sage/gallery/blah.png” the image url will be built as “/wp/…/app/themes/sage/gallery/blah.png” and work fine.

I don’t know if NextGen has this plugin on GitHub, but either way, they should either be notified or be given a PR to use the correct constant for building their URL’s. It should be WP_SITEURL

You can also refer them to Changing The Site URL « WordPress Codex , which says:

The “Site Address (URL)” setting is the address you want people to type in their browser to reach your WordPress blog.
The “WordPress Address (URL)” setting is the address where your WordPress core files reside.

Obviously, they should have no need to be referring to the URL where the WP core files reside. People who use the Home URL just took a guess and it worked for them.

Multitude of plugins, especially “premium” ones are especially bad at this. They use either of constants or even do mix&match. Some have requirements that WP_HOME and WP_SITEURL should be equal :wink:

So… generally it’s not that one should correct image paths to match ones expected by plugin, plugin authors should use proper constants :smile:

Found another solution by editing only the deploy.rb file (we’re using bedrock-capistrano for deployments) and wrote a quick blog-post about it. It basically involves making web/wp/wp-content/gallery shared but also re-creating the shared folders after Composer runs.

One of the NextGen Gallery developers here.

You can add to your config/application.php:

define(‘NGG_GALLERY_ROOT_TYPE’, ‘content’);

And in our Other Options page’s first field set the gallery path to just “uploads” to place new galleries in web/app/uploads/(gallery-name). We do generate image URL from the WP_SITE_URL as we should, but (for legacy purposes now, there’s a lot of existing galleries out there…) galleries are relative to ABSPATH and the default is for “/wp-content/gallery” which matches the majority of WordPress installations. You will need to adjust any existing galleries’ path after setting that constant.

I’m only now getting into Bedrock; is there a safe way NGG could detect it and set that constant appropriately at initialization?

1 Like

hi, i have added the line :

define(‘NGG_GALLERY_ROOT_TYPE’, ‘content’);

to application.php

my gallery images are located in app/upload/gallery

i have set the gallery folder in ‘other options’ to -

uploads/gallery/

I have cleared the image cache in ngg and its still not working. do i have to do something else?

my gallery images are now using the path:

http://myboxingsite.local/app/wp-content/gallery/boxing/thumbs/thumbs_wbba105.jpg

thanks