michaijtsma / grav-plugin-dir-gallery

Grav CMS Directory gallery plugin
MIT License
2 stars 0 forks source link

Loads Gallery but not Images #1

Open akator70 opened 1 year ago

akator70 commented 1 year ago

Thanks for creating this plugin!

I've got the plugin installed and it displays a nice gallery, but none of the images load in lightbox after selecting them. Lightbox loads but there's just a spinning loading icon and no image appears.

Any suggestions?

umbraesoulsbane commented 1 year ago

I am having the same issue. I run my grav site out of a subfolder, but the A HREF to show the image runs off the root.

i.e. Images are here: /cms/photos/gallery/image.png

Plugin is setting the HREF to: /photos/gallery/image.png

The gallery loads fine but viewing the image is just a continuous load.

umbraesoulsbane commented 1 year ago

I was able to fix this by changing line 29 in plugins/dir-gallery/shortcodes/DirGalleryShortcode.php and changing it from:

'slug' => "$image_route/$image_directory",

to:

'slug' => "/cms$image_route/$image_directory",

This adds /cms to the Url Path where my images actually exist from my previous example above.

It appears the code does not properly represent the install folder of grav in the url path. The Gallery grid is loaded by File Paths instead of URL Paths which is why it works and the display doesn't. This is a major oversight as most Grav tutorials have you load it into a subfolder like I am doing.

prikle commented 7 months ago

I had the same problem, apparently the addon only works when the GravCMS is installt in the root directory of a domain.

I have changed the following to solve the problem:

File: user/plugins/dir-gallery/templates/partials/dir-gallery.html.twig

Change in line 4 and 13: from: <a href="{{ slug }}/{{ image.filename }}" to: <a href="{{ base_url }}{{ slug }}{{ image.filename }}"

I will test if it works with the changes when the GraveCMS is installed in the root directory. If so, I will submit a change request.

SebastienGrall commented 6 months ago

@prikle

It's working for me, thanks!