Slick Image Gallery

theme-component
(Joe) #13

cross post:

5 Likes

(François Douville) #14

Is it normal that the text is not displaying?

1 Like

(Vaping Community) #15

This isn’t working for me:

Discourse: v2.0.0.beta10 +49

0 Likes

(Joe) #16

@Francois_Douville

No, it’s not normal. I think I know what the problem is, the theme might need to be translated. I will post an update on that soon.

@Vaping_Community

I just checked on v2.0.0.beta10 +49 and everything seems to be working in order.

Can you share more details about what’s happening on your install?

4 Likes

(Vaping Community) #17

For some reason it wasn’t working with larger images, had to reset some settings and refresh to get it to work but it is working now, great theme addon, thanks!

1 Like

(François Douville) #18

Is it possible to display another icon? My community thinks they have to display slick even if they have 1 image.

1 Like

(Taylor) #19

If you have a font-awesome icon in mind, you can do something like so:

.SlickGallery .fa-picture-o:before {
    content: "\f152";   // font awesome code
}
5 Likes

#20

Later edit: my mistake.

The right mode is like this:

<div data-theme-slick="1">

![Assassins_Creed_Odyssey|690x388](upload://5G3oHJo7Ndmg8bOcmAUqFCve1I.jpg)
![Assassins_Creed_Odyssey_3|690x388](upload://3Y29aUZR2NvZqzqT2z2M5WC6WlM.jpg)
![Assassins_Creed_Odyssey_2|690x388](upload://mJXUqsUu1KEYiTWeyPpSyRQ2eVc.jpg)
![Assassins_Creed_Odyssey_1|690x388](upload://fLeh0qfIhTuYCI4sSi6W1I8dQ2g.jpg)
![Assassins_Creed_Odyssey_4|690x388](upload://iFBHuU1xflxCZlJneTUKiMUjru2.jpg)

</div>

Not like this:

 <div data-theme-slick="1">
    ![Assassins_Creed_Odyssey|690x388](upload://5G3oHJo7Ndmg8bOcmAUqFCve1I.jpg)
    </div>

  <div data-theme-slick="1">
    ![Assassins_Creed_Odyssey_3|690x388](upload://3Y29aUZR2NvZqzqT2z2M5WC6WlM.jpg)
    </div>

 <div data-theme-slick="1">
   ![Assassins_Creed_Odyssey_2|690x388](upload://mJXUqsUu1KEYiTWeyPpSyRQ2eVc.jpg)
    </div>

How can I make the images look like here? Without the black background.

Summary

0 Likes

(Joe) #21

This has to do with the aspect ratio of your images. Slick always maintains the original aspect ratio of the image.

The height of each gallery is determined by the height of the tallest image in it. The width of the gallery is always the full width of the post.

The images you add are slotted in and centred both vertically and horizontally in the gallery. This prevents the page content from moving around when you navigate between images of different heights and keeps the navigation buttons fixed in one place.

You can control the color of the background with:

.slick-track {
    background: black;
}
5 Likes

(Joe) #22

Crosspost


I took a look at the translation issue @Francois_Douville I have a temporary workaround for now. You need to make a small edit to the theme. Go to the </head> section and look for this:

You need to change en to fr

So

  I18n.translations.en.js.composer.tiles_add_images_prompt = settings.Tiles_add_images_prompt;
  I18n.translations.en.js.tiles_gallery_button = settings.Tiles_button_text;

becomes:

  I18n.translations.fr.js.composer.tiles_add_images_prompt = settings.Tiles_add_images_prompt;
  I18n.translations.fr.js.tiles_gallery_button = settings.Tiles_button_text;

That’s all you need to change.

Because this is a local edit, you need to reapply it after every theme update, but it’s not a big problem because you only need to change two letters.

I will keep looking for a better way to integrate translations into themes and will keep you posted.

4 Likes

(Joe) #23

Tiles / Slick got a tiny update today that deals with the translation issue. They will now use the awesome locale check described in @Simon_Cossar’s great post here :raised_hands:

The locale for the translated strings will automatically be set and you will not need to mess around with the theme code after this update.

2 Likes

(James Cook) #24

This is refusing to work on v2.2.0.beta3 +130

My images are larger than the maximum allowed dimensions, I get the gallery preview but in the actual post the gallery isn’t displayed, just normal images. Could you confirm that this works on the version I have installed? Thanks

0 Likes

(Joe) #25

Sure, I checked and everything seems to be OK on v2.2.0.beta3 +136

Do you mean lighboxes or just images? Slick only targets lighboxes so that would explain why it’s not working for you. If that’s the case, It sounds like sidekiq is paused / not running on your site. Try checking

your.domain.com/sidekiq

3 Likes

(James Cook) #26

Thanks for the reply. There was an unknown issue on my site that was causing lightboxes to take a few minutes to generate, and it was this that was causing this plugin not to work. All seems to be working now :+1:

4 Likes

(Henry W) #27

@Johani I’m wondering why this component calls slick.min.js from cloudflare instead of being packaged with the component?

1 Like

(Joe) #28

At the time, the Discourse theme system was a bit different.

Scripts added to a theme / component used to be loaded inline in the <head> of the document. It made a lot more sense to load it from a CDN.

Discourse themes now handle scripts much better thanks to @xrav3nz’s work :heart: :raised_hands:

https://github.com/discourse/discourse/commit/6acdea37c4e77723c774152e9076dfedda99493a

scripts are now pulled into an external theme.js file.

So, it now makes sense to bundle slick into the theme instead of loading it from a CDN.

I just pushed a small update for that :+1:

7 Likes

(Henry W) #29

Thanks for the explanation and the quick fix!

1 Like

(Globulle) #30

Hi,

For an obscure reason I cannot achieve the expected slideshow. My code is :

<div data-theme-slick="1">

![IMG_1903|640x480](upload://p1oiiQ1oeNUOYY7nNETBuerrduz.jpeg)
![IMG_1923|640x480](upload://il3ESwgSA3szneJ0y0S92FEISwr.jpeg) 
![P1310402_small|666x500](upload://4H0qqhqtH8W3VA0XHxjKgXZO332.jpeg) 
![IMG_1927|640x480](upload://1QICzfj34S6zS963xb9JQ8PAJkK.jpeg)
![IMG_1958|640x480](upload://8XLYdnbXaKasrjEhyhXaPvIGNHK.jpeg)
![P1310413_small|666x500](upload://1egsIAMlC7RwlKqTGghS5wsUjfz.jpeg) 
![IMG_1996|375x500](upload://e5HXMa7aYAnPlP3JHrI4PQTgjjf.jpeg) 

</div>

I obtain :

  • the 1st two images outside the slideshow
  • the 3rd, 6th and 7th images are in a slideshow without the 4th and 5th (don’t show up at all)

I assume this is linked to the different sizes of images… so is there a workaround other than changing the size of the source pictures? It seems that changing the size parameter in the code does not improve things.

Any help would be appreciated! :slight_smile:

EDIT : now I’ve tried with all images reduced to the same size : they are all displayed one below the other, and no slideshow at all… :frowning:

1 Like

(Joe) #31

Thank you for the detailed feedback :+1:

The issue you’re seeing occurs because you’re using small images. The images you’re using are not large enough for Discourse to generate lightboxes.

There are two relevant settings for this

max_image_height which defaults to 500px

max_image_width which defaults to 690px.

Discourse looks at images uploaded in posts and if they exceed the demisions set in either of those settings, it creates lightboxes for them.

Now, you’re free to change those the values of those settings on your site to force Discourse to generate lightboxes for smaller image; however, I would not recommend doing that.

That setting is also linked to the max deminsions an image can be displayed at, so if you change max-width to say… 500px, then the maximum width any image will display at in a post will also be 500px - the same applies to changing the max-height setting.

What I would recommend is to use larger images that exceed either the max-height setting or the max-width setting. The component would then work with those images without any issues.

Let me know if the problem persists.

7 Likes

#32

After the last update now the arrows are missing:

Desktop:

Mobile:

1 Like