How to change image format of the image clicked on tagdiv gallery

Posted in: Newspaper
Post count: 8

Hi,

I’ve created a new page template for my custom post type ‘event’.
On this template, i pasted the tagdiv gallery shortcode with specific images ids as arguments. Everything works fine as each image is displayed with the {width}x420 image format of NewsPaper theme, in the gallery.

The thing is:
When an image in the tagdiv gallery is clicked, the gallery shows up as “full screen”, displaying each image with its original format, meaning if i would have uploaded 30Mb images, the tagdiv gallery in its “full screen” mode would have displayed 30Mb images.

My question is:
Is there a way to call a specific (already generated) format of image when the gallery is displayed in “full screen” mode? I would like to replace heavy original images by a compressed format.

Thanks for your help,

Jacques

Post count: 20688

Hi,

Could you provide a link to a page where this happens? In pages you can create galleries within a text element
https://forum.tagdiv.com/topic/need-to-insert-a-grid-gallery/
When clicked the images should be opened in a modal with the full image size. Same as here
https://demo.tagdiv.com/newspaper/td-post-aston-villa-beat-liverpool-to-join-arsenal-in-the-fa-cup-final/

Thanks

Post count: 8

Hi Simion,

Thanks for your answer. I must admit I didn’t explain what i would like to do very well.
-The TagDiv Slide Gallery is inserted and works very well on my site.
-When clicked, the modal also appears exactly like in the demo link you provided.

But, as in the demo, what I can see is that when you display that modal with the full image size, it is actually the original uploaded image that displays. Meaning that if I upload heavy images, like >10Mb, those would be duplicated in different formats (wordpress thumb, small, medium etc… and Newspaper formats as well) but still, on click on those images, the original ones (>10Mb) would be loading.

As i permit my users to upload images that could be displayed in galleries automatically, they could upload images up to 5/10Mb (depending on the MAX_FILE_SIZE i would parameter in the input).

That said, I would like to know if there is a way to change the default behavior of the TagDiv Slide gallery on click on an image :
=> The click would still display the modal with a big size image, but I don’t want to load the original one, I would prefer to load a predefined, lightweight format (even maybe having to define a new image size on upload if necessary).

Is there a way to change that behavior of getting the original image on click? (asking for hooks or a way to inherit/override the TagDiv Slide gallery code)

Thanks for your support,

Jacques

Post count: 20688

Hi,

That will be the case yes. The full image will be displayed, not a thumbnail like initially loaded in the gallery. If you have such big images that would be a problem.

Try to set a medium size here – https://www.screencast.com/t/7nPasHua
That should display a medium thumbnail instead of the fill image in the gallery modal.

Post count: 8

Hi Simion,

Thanks a lot for your answer, it works like a charm.

However, it works if I directly change the thumbtype in td_wp_booster_functions.php of Newspaper Parent theme. I tried to inherit the file to override the default thumbtype in my Newspaper child theme, by copying/pasting the includes folder but it doesn’t work.

Is there a way to override the td_wp_booster_functions.php file in my child theme without editing it directly? I would like to do so to prevent reset by future Newspaper updates.

Thanks,

Jacques

Post count: 20688

Hi,

Doing it in a child theme would indeed be helpful in this case, but unfortunately it is not possible for that file, it’s not supported.
You would have to make this modification after each update, or maybe backup the file and replace it after a theme update.

Note that the file could be modified by us as well, check in the list of modified files before you update the theme.

Thanks

Post count: 8

Hi,

Thanks for your answer. It’s a pity it’s not inheritable at the moment, but gladly modifying the parent theme still do the trick, so i’ll stick with that. I’ll be checking modified files of future updates as you recommended.

Enjoy your weekend,

Jacques

Post count: 8

Hi Simion,
Since i recently asked you how to change the thumbtype of the image displayed after a click on the gallery, another question came to my mind.
I change the thumbtype of the image showed after a click on the tagdiv gallery, as you said, to display a medium size one.

My question is :
If someone uploads an image, WordPress and Newspaper Theme are generating their respective thumbtypes from the original one. Is the original one still displayed anywhere in NewsPaper Theme? I mean, is it still useful? I would like to permit a lot of users to upload images, without any restriction on max file size. Is it possible for me to delete the original image after WordPress and Newspaper have generated their own formats? I would like to do so to save space on the server hard drive.

Thanks

Post count: 20688

Hi,

If the image is used in the post content in the full size, the original image would be needed. Or as a full size background for various elements.
There could be other instances where the full image is needed, but you could give that plan a try however and see what happens.
I even found a plugin for this task specifically (kind of outdated), could be others
https://wordpress.org/plugins/delete-original-image/

Thanks

Post count: 8

Hi Simion,

Thanks a lot for your answer.

I’ll be trying that

Viewing 10 posts - 1 through 10 (of 10 total)
The forum ‘Newspaper’ is closed to new topics and replies.