Facilitate mass conversion of photo galleries to paragraph bundles

Created on 23 June 2024, 6 months ago
Updated 9 September 2024, 3 months ago

Problem/Motivation

Trying to create an alternative to photo galleries that currently use the Juicebox contrib module. Juicebox depends on not open source Javascript code that is supplemented by Windows or MAC software to create an xml file that contains options and files for a given gallery. It appears that Paragraphs bundles, in conjunction with the SOLO theme could provide an alternative. But ... see below ...

Steps to reproduce

Use the paragraphs bundles to create a slideshow. While this approach "works" for a small sample size it creates difficulties with say 129 photo galleries and more than 5000 jpg files. These files are not media files in the sense of being created in the media module.

Proposed resolution

Come up with a solution that allows more of a cookie cutter approach to creating galleries so that what is now on the Display tab could be standardized. Recognizing that different sites might want different settings for the display tab there could perhaps be several settings stored for it that could be referenced while building individual galleries. Allow "standard" image files (those normally stored in sites/default/files) to be used instead of or in addition to media files. Icing on the cake would be to allow an entire subdirectory to be used in a given gallery.

✨ Feature request
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States fkelly

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @fkelly
  • πŸ‡ΊπŸ‡ΈUnited States fkelly

    Not trying to promote my own web site, but you can see a sample photo gallery from there at:

    https://fkelly.org/web/dana

    Note that the title at the top of the page and a list of thumbnails at the bottom are standardized. I could even live without the thumbnail listing. On my local site I have created a half dozen or so galleries over to paragraph bundles. The workload to insert 5000 jpg files (after individually creating media module copies of them and to customize the settings for each gallery is daunting.

    I suspect we could probably use paragraphs bundles for all these galleries if we could have (a) a standard setup and (b) use the original image files rather than converting them to media files one by one.

  • πŸ‡ΊπŸ‡ΈUnited States fkelly
  • πŸ‡ΊπŸ‡ΈUnited States fkelly

    Looking further: been wondering why images need to be converted to media items before being put in a slideshow. As I mentioned I have several slideshows (about a half dozen) converted on my local system and each creates media files (jpgs) that mirror the original jpg files that I used in the original version of the slideshows.

    Doing file comparisons between the original jpgs and what is converted into a media item: they are exact duplicate files. There may be other reasons media items are needed but I don't see what they are. The creation of media items adds an extra and tedious step to album creation and unnecessarily creates duplicate files ... as far as I can see.

    What I need to create an album is:
    1. album wide options, such as title, album width(with intelligently chosen defaults to reduce duplicate input)
    2. a file matrix (rows and columns of image files) basically

    3. Some other options for the whole content type of "slideshow". These options could be left to individual web sites. For instance, I use a field called "order of album" to sort albums when presenting them. Then a field for each album called "representative image" ... selecting one image from each album ... so that if I want to use a view to list a group of albums on a menu I can just sort the view display by "representative image".

    This approach would all be done, as paragraphs seems to be done, within the base Drupal content types and structures without any need for ancillary Javascript. And of course we'd rely on Drupal's current (great) approach to making responsive pages using image styles.

  • πŸ‡ΊπŸ‡ΈUnited States fkelly

    A few days ago I said:

    Doing file comparisons between the original jpgs and what is converted into a media item: they are exact duplicate files. There may be other reasons media items are needed but I don't see what they are.

    Experimenting on my local system I see that involving the media module and creating "media" versions of original jpgs creates not only "duplicate" versions of the jpgs but also webp versions of the same files stored in a sites/default/files/styles/pb_original_size/public/2024_06/somefile.webp and that it is this webp which is displayed as part of the gallery.

    Granting that webp may be an improvement over jpg and that the media module may assist in "responsiveness", this is still a long way around rosey's barn (so to speak) for a conversion of older galleries to paragraphs bundles slideshows. I suspect that this is triggered by defining the image field as
    Image pb_content_image Image pb_content_image
    Entity reference // Reference type: Media // Media type: Image (PB) // Entity reference // Reference type: Media Media type: Image (PB)

    and I don't know if it would be possible or technically desirable to just have a plain image field in a simplified (non media module related) version of the slideshow.

  • πŸ‡ΊπŸ‡ΈUnited States flashwebcenter Austin TX

    Hello,

    You don't have to use media images inside the slideshow. You can create a paragraph bundle with an image that will use the default image. I made a video on this topic. Additionally, I want to mention another useful bundle: the lightbox image grid. I hope this is helpful.

    Best wishes,
    Alaa

  • πŸ‡ΊπŸ‡ΈUnited States fkelly

    Very helpful, thanks. I am part of the way there after an hour of tracing through the slideshow and experimenting on my local system.

    I can, at least, avoid using media.

    However, I have an existing structure for the galleries in sites/default/files. I have two "root" directories for galleries. Each of these root directories has a series of subdirectories and in each of these subdirectories there is an xml file that specifies the files and options that go in each gallery and then a series of jpg files. Let's just say for one gallery:

    root1
    gallery #1
    xml file 1
    jpg file 1 ... 2 ... 3 etc.
    gallery #1

    The xml file will have no bearing on the new "paragraphs" based arrangement.

    Following the instructions in the video, I can upload jpg1, 2 and 3 and they work in the gallery. But the files that are uploaded are duplicated over into a sites/default/files/2024-07 directory. But I would like to use jpg1, jpg2, jpg3 in the gallery and not upload duplicates into 2024-07 (and use those duplicates in the gallery). (i just did a file comparison and the files are identical).

    I will keep experimenting and look at the other options you mentioned. If there is a way to just link to existing files that would be great. I would love to be able to preserve my existing data structure for the gallery files and reuse whatever is already there.

    Thanks again.

  • πŸ‡ΊπŸ‡ΈUnited States fkelly

    Quoting myself from #7 "I can, at least, avoid using media." ... maybe not

    Found this : media and files β†’

    Others have gone down the same apparent dead end path I am trying to follow. It seems. It's logical that Paragraphs would use media in a post 2020 era ... rather then just stuffing files (however well organized into directories) into sites/default/files... On the other hand having a logical directory structure for a large set of files would also be handy. There are some media_directories contrib modules as well as some modules and devel generate functions that might bridge the gap. I doubt that the juice is worth the squeeze.

    I am still trying to work through the suggestion(s) in #6.

  • πŸ‡ΊπŸ‡ΈUnited States fkelly

    Found paragraphs bundles node reference. Able to link between the slideshow setup and an "old" set of images that were in sites/default/files .... for a Juicebox slideshow. The content type becomes PB Node Reference. But it allows me to pull in an image from sites/default/files ... and display it. Will continue on to see if this will work for multiple images in a slideshow while leaving the original 1000+ jpg files in place and not converting them to media.

  • πŸ‡ΊπŸ‡ΈUnited States fkelly

    The information in https://www.drupal.org/project/paragraphs_bundles/issues/3456431 ✨ How to Create a Paragraph and Attach a Background Image in Drupal | Paragraphs Bundles Tutorial Fixed and the videos attached to it, help resolve the problem of using images from sites/default/files rather than media files. As an added bonus I appear to be able to select a number of images with one selection ... especially since my images are organized by the gallery names that they are contained in. That will save me a lot of work! It is great that we don't have to use media.

    I still have some details to work out but this looks very promising.

  • πŸ‡ΊπŸ‡ΈUnited States fkelly

    Sigh

    Well, the images I'm using from sites/default/files/jboxgalleries ... x_gallery (where x gallery is one of many galleries there) are not getting created as media items. So that's a plus.

    However, they ARE BEING duplicated over into sites/default/files/2024-07 so that's kind of better than them having to be media items but still not allowing the reuse of existing images within the slideshow/. If these were a few files, okay, I'd deal with it. I have 2950 image files being used in galleries (slideshows).

    The appropriate and efficient use of slideshow sections and slideshow section body is not clear to me either. I can have a slideshow section with say, 6 images nested under it and when I view the slideshow those will show consecutively and individually. But if I create a slideshow section body and nest 5 images under it, they show stacked one above the other vertically. I've also had situations where multiple images in one slideshow section (not a "body") stack vertically. When I go in to add a file to a section or the body and click on choose a file I get a list of files in the most recent directory. And I can select multiple ones of these. I could picture a situation where I could basically load an entire gallery of 20 or 30 images with one selection action. They'd would also be in the order I want them to be because the list is in that order. That would be too cool.

    Maybe some documentation on how "slideshow section" versus "slideshow section body" is supposed to work. If you have multiple images do you put them in the slideshow section or the slideshow section body. What's the difference between these?

  • πŸ‡ΊπŸ‡ΈUnited States flashwebcenter Austin TX

    Hello,

    The slideshow_bundle contains a paragraph field named pb_content_slideshow_section. Within pb_content_slideshow_section, you can enter the slideshow_section_bundle, which includes a paragraph field named pb_content_slideshow_body. In pb_content_slideshow_body, you can enter the image bundle which it has the media field.

    Each section represents a slide, and each slide can include multiple types of content. For example, a slide can have an image with a description at the bottom. Hopefully, that will be helpful to you.

    Best wishes,
    Alaa

  • πŸ‡ΊπŸ‡ΈUnited States fkelly

    Thanks for the clarification on slideshow bundles. That will be helpful if I can ever overcome the file duplication issue.

    Here is what happens. Creating a slideshow I get to the part where I add a slideshow section body. I've created a paragraph type named slide_image and am trying to embed it in the slideshow section body. I get a form (see file attached to this issue) to "Add a new file" with a "Choose files" option. In PHPstorm I've traced this down to "web/core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php" the file widget program from core. (I put an "xxx" before the text for "Add a new file" in the program and the xxx shows up in the data entry box).

    So I know that the program is going to FileWidget from core and I can tell from what's in my sites/default/file directory that, if you try to add a file that duplicates a file that is already in sites/default/files, it will simply rename the file with a extra characters to avoid creating duplicate files. (e.g., you wind up with "three_kids_dance.jpg" "three_kids_dance_0.jpg", "three_kids_dance_1.jpg" etc.)

    That's clever to avoid duplicate files but what we really want is to create a link to one existing file wherever it is already stored in sites/default/files. Which in my case would be a gallery directory in a separate area.

    So, yes the image content type does work to avoid creating media items where they aren't wanted or needed but it doesn't help with the duplicate files issue. Nor does it allow you to link existing image files in to a slideshow. And,if you look at the list of files in the png file I've uploaded, what would really be cool would be to be able to bring up an existing gallery image directory, select all the files, and link to them as a series of files in a slideshow section.

  • πŸ‡ΊπŸ‡ΈUnited States flashwebcenter Austin TX

    Hello,

    I am developing a new module " Paragraphs Bundles Import β†’ " that will help you create accordions, slideshows and tabs using original images. It's currently in progress, but once it's complete, I'll provide a video tutorial on how to use it.

    Best wishes,
    Alaa

  • πŸ‡·πŸ‡ΊRussia urix

    I stumbled upon this thread researching the only thing: am I able to add IMCE file picker to the Media Library or not?
    It seems like I can't.

  • πŸ‡ΊπŸ‡ΈUnited States flashwebcenter Austin TX
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024