Thumbnail image gallery

8 posts by 2 authors in: Forums > CMS Builder
Last Post: March 4, 2016   (RSS)

By Damon - March 3, 2016

Hi,

Here is some code that will output the regular size image and the thumbnail version of the image:

<?php foreach ($galleryRecord['images'] as $index => $upload): ?>
<li><a href="#"><img src="<?php echo htmlencode($upload['thumbUrlPath']) ?>
    data-large="<?php echo htmlencode($upload['urlPath']) ?>" alt="<?php echo htmlencode($upload['info1']) ?>" data-description="Richard Marti Gallery" /></a></li>
<?php endforeach; ?>


Also, make sure that for the Images field in CMS Builder, you have the Create thumbnail checkbox checked and the height set to 65 or whatever thumbnail height you want.

Let me know if you have any questions about this.

Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By MercerDesign - March 3, 2016

I can't use the thumbnail feature in the CMS, that is why I have had to create 2 different fields, the thumbnails have to all be the same width so using the thumbnail feature does not work.

By Damon - March 3, 2016

I'm not sure I understand why you can't use the thumbnail field. It can be set to make with the thumbnail images heights or widths the same.

Is the image that you want to upload in the 2nd upload field cropped prior to upload? 

Could you provide some more details about how this should work for the user?

It is possible to use two different upload fields together but it will take much more time to write code to make that work. The ideal solution is to use the automatically generated thumbnails if possible.

Can you provide some more details?

Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By Damon - March 3, 2016

Just reread your original post and see that you are cropping the images for the thumbnail uploads. 

What about cropping the larger image to the right dimensions and then all the thumbnails would be correctly sized too?

Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By MercerDesign - March 4, 2016

I can't crop the large image to all be the same because some images definitely need to be portrait and some are very wide panoramic shots, that's why I have used a responsive image gallery function.

By MercerDesign - March 4, 2016

Hi, thank you for your help, I have got around using the thumbnail function with some clever css.

By Damon - March 4, 2016

Thanks for the update. Glad you were able to find a solution.

I was just starting to investigate if setting overflow: hidden with set height and width might be workable.

Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/