In light of the recent COVID-19 pandemic - OPTASY would like to offer DRUPAL website support for any Health Care, Government, Education and Non-Profit Organization(s) with critical crisis communication websites or organizations directly providing relief. Stay Safe and Stay Well.

This is How You Build a Slideshow in Drupal 8

This is How You Build a Slideshow in Drupal 8

by Adrian Ababei on Apr 13 2017

              

Need to create a visually stunning slideshow for your Drupal 8 site? One that you should be able to effortlessly customize to your liking?

Luckily, this rhetorical question suggests to you its own answer: the Views Slideshow module in Drupal 8!

An empowering tool which enables you, after just a few intuitive steps to take for setting up the right context and for pulling off the due configuration, to create your own slideshow (of any type of context, not exclusively images).The one to appear in a View.

Moreover, it grants you almost unlimited power of customization, as well! Practically you get to put together a personalized “combo of settings” for each one of the Views that you'll create.

Now let us proceed with our step-by-step guide on how to build a slideshow in Drupal 8 using the Views Slideshow module (had to specify this, since there's also the Slick method for building slideshows in Drupal):

 

1. First and Foremost: Install All The Needed Modules and Libraries

First things first: before you rush in and “play” with all the settings put at your disposal, you need to properly download and enable everything you'll need for building your slideshow.

Well, these are the main steps to take:

1. Start by making up your mind on how you'll download your Views Slideshow module, (its Drupal 8 version obviously): will you download it directly from its module page on Drupal.org or by using Drush? If you prefer the Drush alternative, these are the lines what you'll need to enter: drush dl views_slideshow then drush en views_slideshow -y (for enabling your module)

2.  Now if you've chosen the first method instead, simply unzip the file you will have downloaded from the module page and paste it to your Drupal 8 site's directory: yoursitesname/module  

            

3. Keep in mind that you'll need to enable Views Slideshow Cycle, as well

4. Can you spot the “Download ZIP” button on the top right corner of your screen? If so, just click on it!

5. Unzip the library that you've just downloaded

6. Once you've unzipped it, create its future folder, naming it "jquery.cycle"

7. Now pay particular attention to this step (since it's in this aspect that the two apparently identical installations processes, Drupal 8's and Drupal 7's, differ): you'll need to upload your resulting files to the libraries/ folder in the root of your website

8. And this is what you should be looking at right now if everything went well with all the downloading and enabling steps you've completed so far

 

9. Now you'll need to create a brand new content type that should contain your slides: Structure > Content Type > Add content type

10. Next, you'll inevitably get to the Manage Fields section. Go to “Add a Field” and make sure you'll have a content type with an image field attached.

 

2. Build A Views Block 

1. Head to Structure > Views > Add new view

2. Think of a suitable name for it

3. Click on “Create a Block

4. In the block's settings- “Display format”, select “Slideshow

5. “Save and edit

 

6. Can you spot the “Field” section, on the left side of the screen? It shows only “Content:Title” by default right now; feel free to delete that default title if you don't find it necessary to have it displayed on your Drupal site

7. Click on the “Add” button

8. Next, look for your image field, then scan through all the available fields there and select the one(s) you'd like to include in your slideshow

9. Then click on “Add and configure fields”. Also, in order to set up your slideshow's style (all its future effects here included, as well), go click on "Slideshow",  under “Format”.

10. Click on “Apply

11. There! Now you should be able to vizualize your recently added image in the Preview section that you have in the bottom of your page!

12. As soon as you're done adding all the fields that you consider a “must” to your slideshow, just click on “Save”. 

And voila! You've just built your Views block!

Let's move on to the next key step to take as you build a slideshow in Drupal 8:

 

3. Configure and Then Publish Your Slideshow Block

Finally! You're closer than ever to getting your View displayed on your Drupal 8 site:

1. Go to Structure > Block layout 

2. Once there, click on the "Demonstrate block regions

3. Next, carefully select the area on your website that you'd like your slideshow to show up. Do you want it displayed in “Sidebar first” or maybe in “Content” or rather in the bottom of the page?

4. Once you've decided upon the region that you'd like it published on, just click on the “Place block” button (you'll find it next to “Content”)

5. Another more key selection to make are we're almost done! Choose the page that you'd like your slideshow to get published: scan through the list of web pages displayed under “Pages” and... make up your mind.

6. If you're dealing with a block region including several regions, ensure that your block is properly placed, as well!

7. Once you've made your decision, click the “Save block

At this point you must be looking at your slideshow published on your Drupal site!

 

4. Set Up Image Styles for Your Slideshow

By now you must have already noticed that the images that you will have included in your slideshow are of different sizes.

The solution, so that they should all fit into the block region? Creating an image style!

1. Go to Configuration > Image styles > Add Image style

2. Name your image style

3. Next enter a "Machine readable name

4. Click on the “Create new style” button

5. Next go to “Effect” and select an image effect from those listed in the drop-down menu (Crop, Resize or... another one)

6. Then set up your image's width and height (keep in mind that they will depend greatly on your chosen block region's sizes)

7. Finally click on “Update effect

 

8. Now it's time to edit your View

9. Click on your image field (under the “Fields” area) for getting it edited

10. Next in the “Image Style” field simply select the style you've just created

Click “Save” and feel free to check your slideshow on your website.

Useful Tip: in case you're facing the challenge of building a responsive slideshow in Drupal 8, remember to enable the “Responsive images” module in Drupal core. 

 

5. Add Some Controls, too, As You Build a Slideshow in Drupal 8

Since it must be more than just a visually impressive slideshow that you might want to put on your Drupal 8 site, but a user-friendly one, too, aimed at enhancing users' navigation on your website, some controls are definitely a must.

Therefore, here's how you add them:

1. Go back to the screen where you get to edit your view

2. Click on “Settings” (neighboring “Slideshow”, under Format)

3. There, select your controls: go for a pager, a counter or for previous-next buttons...

 

TADA! This is how you build a slideshow in Drupal 8!

Give it a try! If we've skipped adding any crucial information to our our step-by-step guide, feel free to “warn” us. Also, if you encounter any type of problems through the process, don't hesitate to let us know. We're ready to use our Drupal expertise to “save the day”, your day!

 

Development

We do Web development

Go to our Web development page!

Visit page!

Recommended Stories

10 Best Tools for Conducting a Drupal 8 Site Audit (to evaluate its performance, security, and stability)
You want to audit your Drupal website's infrastructure, SEO, best practices, security, stress, overall performance... And you ask yourself: Are there tools that help you run a Drupal 8 site audit? ... and generate the reports you need? There are quite a few, actually. To narrow down your too many options, we've made a list of 10 tools and Drupal modules that you can use to test your website's performance, security, and stability. 1. 3 Best Tools to Run a Website Security Audit 1.1. Coder     What does it do? it checks your code to see whether it meets the industry standards it checks your text, so you'll know whether i's properly sanitized or not quite In short, a Drupal 8 audit module you'll want to have in your toolbox when conducting a website security audit. 1.2. Qualys SSL Server Test Another tool that you'll want to use during your Drupal 8 security audit process. Why? Because it performs a thorough analysis of a public SSL certificate and generates a grade for you. 1.3. Security Kit How does it work?  It provides you with a set of security-hardening options, that strengthen the shield around your site against CSRF, XSS, and clickjacking attacks. 2.3 Best Tools to Run a Drupal 8 Site Audit Focused on Its Performance 2.1. PageSpeed Insight, YSlow, GTMetrix  Take these 3 website performance audit tools as your the "swiss army knife" in your toolbox.  They run multiple tests on your website and generate a whole set of practical recommendations on how you can boost its front-end performance. Here are just some examples of recommendations: cut down on the number of elements the browser's forced to parse by simplifying the DOM cut down on the number of requests  by aggregating your JS files or using image sprites 2.2. New Relic An all-into-one Drupal site audit module that helps you monitor different sections on your website: from infrastructure to server, to browser and application. Now, here's precisely why you'll want to keep it close at hand while assessing your website's performance: it allows you to set up multiple customized dashboards that show graphs and charts of your website's performance data it enables you to keep an eye on your website's traffic and performance in real-time it allows you to isolate bottlenecks and set up alerts for key events 2.3. Performance Monitor   Let's say you've just moved your Drupal website to another hosting and you now feel that it has slowed down. And that the new server needs to be optimized for Drupal. This is precisely where this module comes in handy: It gives you a clear picture of how your website's performing now, while comparing different servers/hostings. Here are some of the features you'll love: it checks the Mysql status and variables (and provides recommendations) it tests the overall system performance (it runs database, CPU, and file operations performance tests) it evaluates the "Performance score"  3. 4 Best Tools to Evaluate Your Website's Stability 3. 1. Behat, PHPUnit, Nightwatch Or you can put together your own "combo" of unit and functional testing tools. Automated testing will improve your website's stability... in the long-term (and nothing can beat the peace of mind that you'll get). 3.2. Code Sniffer Whenever you need to assess your code's quality, just reach out for this Drupal 8 audit tool. It will... "sniff on" your code and signal you if it doesn't meet the coding standards.  Also, while testing your code's stability, you'll want to have a look at: the quality of your links the cycles of peer review for codes the factors that influence the SEO the access and breadth of documentation the modules you have on your website: are there any outdated ones? 3.3. Tugboat You save time and money using Tugboat (or an alternative continuous integration tool). Here's how: it runs the automated and linting tests that you will have set up and generates a report to your developer before even merging or reviewing the code it builds a completely working website that incorporates that new feature you've added or has that specific bug fixed before it gets merged A true time-saver that you'll definitely want to have in your toolkit when testing newly added code for stability.  3.4. Linting Tools How do they help you increase the stability of your Drupal website? they get all the developers in your team on the same page when it comes to the code format to be used they (i.e. Drupal Code Sniffer) enforce the Drupal coding standards once integrated to your developers' text editors Tip! Make sure you incorporate your linting tools into your automated testing routine, the one that gets performed on each pull request. The END! These are your best options when it comes to the Drupal 8 site audit tools to include in your toolkit. But what if you dread the idea of digging deep into your code, checking every single one of your Drupal modules, evaluating the CPU performance... What if you could still get a clear picture of how you're website's performing without the dread of going through all these tedious, time-consuming tasks? Just shift the burden to us! Drop us a line and let's get your Drupal website checked for all the issues and bottlenecks affecting its performance, security level, and stability! Image by Free-Photos from Pixabay   ... Read more
Adriana Cacoveanu / Aug 06'2020
7 Ways that You Can Reduce Image Size on a Large-Scale Drupal Site, With a Lot of Images
Images can make or... break the user experience. Especially if we're talking about large amounts of images. So, what are your best options to reduce image size on a large-scale Drupal 8 site? And, most importantly: How do you strike a balance between the smallest file size and the best possible image quality? Well, just keep on reading... Here are 7 ways that you can manage image compression on your image-heavy Drupal site without affecting their quality: 1. Use a PNG Optimizer to Reduce Image File Size Let's say that you have a lot of PNG images on your Drupal website. How do you reduce the image file size? Simple: you use TinyPNG to... squeeze them. Expect to reduce them somewhere around 60% (while keeping the lossless image quality). 2. Use a JPEG Compressor to... Compress Your Images Server-Side  "How to make images load faster on my website?" Just use a compressor to reduce image size for your JPG and JPEG files: TinyJPG CompressJPEG Compress Now JPEGOptim It will take... a while, especially since we're talking about an image-heavy Drupal site. Different JPG files mean different settings for you to... play with till you've balanced out size and quality. 3. How to Improve Image Load Times: Use Drupal 8 Image Styles It's a tool that you get... out of the box. And what you gain is more control over the size of the images on your website: Set several image styles, of different sizes, that will go on various areas of a page. Good to know! Configure your image styles just once: from then on, they'll resize all your new images by default. Here's how you do it: Go to "Manage display", in the content type setup section Click the gear wheel icon next to the image field to open the settings tab and choose an image style There, you can either choose one of the previously configured image styles or... create a new one, by selecting the "Configure Image Style" option from the dropdown menu Source: Drupal.org          Good to know! Once you've set your image style, the module updates all the created images... automatically. 4. Use Drupal 8 Image Toolkit to Adjust Their Quality (And Their Size) It's the best way to resize images in Drupal 8. And the easiest way, as well: Go to Admin > Configuration > Media > Image Toolkit Choose the setting that allows you to compress your images (the JPEG quality field) Play with it till your strike the perfect size-quality balance Save the new settings Note! The new setting will apply to all your images; there's no way for you to adjust the quality for each image, one by one. Tip! Stick to somewhere between 60% and 80% when setting the image quality. 5. Use the Responsive Images Module to Resize Your Images  "Which module is used for image optimization?" Which is the best Drupal 8 module to reduce image size on pages that contain lots of images... Responsive Images is (but) one of them. Here's how it works: Its image formatter maps the breakpoint of the original image and renders a responsive image instead. All that by using an HTML5 picture tag (that has sizes and srcset attributes). It basically enables browsers to select the image to display according to the image style selections. And here's how you set up responsive images on your Drupal 8 website: Enable the module (for, even if it's a core module, it's not enabled by default) in Admin > Configuration Select "Responsive Image" Hit "Install" What about breakpoints? How do you set them up? Go to your editor (if it's a custom theme that you're using) Create a file named "yourthemename.breakpoints.yml" in your theme directory ("/themes/custom/yourthemename") Now, its time to configure the image styles for your responsive images: Different breakpoints call for... different image sizes.  Go ahead and pair each breakpoint that you set up at your_theme_name.breakpoints.yml with an image style and create your responsive image styles. 6. Use the ImageMagick Module to Reduce Image Size   "How do I manage compression on my image-heavy Drupal site?" You use ImageMagick. It's another one of your best options for Drupal 8 image resize. Here's why: Drupal might provide the GD2 image manipulation toolkit out of the box and enable you to set multiple alternatives, of different sizes, for the same image. Yet, it lacks some key features, such as... TIFF format support or GIF support with an image style. And this is where the ImageMagick module comes in handy. To install it, just run this command: Composer require 'drupal/imagemagick' And here's how you use it to reduce image size: enable it via ‘yoursite/ path set the quality for your image to 100% in the ImageMagick image toolkit The results? you've just enabled the GIT format support with image style you've reduced your image size by 20-40% Mission accomplished... 7. If It's Still Not Enough, Lazy Load Your Images  "How to load images faster?" Use the Lazy Loader, the ultimate Drupal 8 image optimization solution. Have you tried them all — all the dedicated modules and Drupal core features available — and you're still not satisfied with how fast your image-heavy pages load? Then go even further and incorporate a lazy loading functionality into your website. The END! But maybe you have better things to do — a business strategy to improve, urgent projects to work on — than finding and implementing the best solution to reduce image size on your Drupal website. Yet, you still want to make your pages load faster... So, just pass on the "burden" to us! We'll identify the best solution for speeding things up on your image-heavy web pages and... implement it for you sitewide. Image by Alexandra_Koch from Pixabay   ... Read more
Silviu Serdaru / Jul 23'2020
Drupal Performance Optimization: 17 Drupal Caching Best Practices To Speed Up Your Page Load Time- Part 2
"How can I make my Drupal 8 website faster?" Are you still struggling with this? Still striving to figure out which are the best (and most straightforward) Drupal performance optimization techniques for your website? Well, here I am today with a handful of 9 more ways that you can speed up your Drupal site. In addition to the 8 ones that I covered in the first part of this post. And yes: it's another round of Drupal caching best practices that'll help you boost your page load time. So, let's dive right into it: Tip #9: Use the Dynamic Page Cache Module  ... to cache for both authenticated and anonymous users. Unlike the Internal Page Cache module, that I mentioned in Part 1, which only caches pages for anonymous users. Tip #10: Use Distributed Cache, A Highly Effective Drupal Performance Optimization Technique But how does it work, more precisely? Once you've installed a distributed cache, it'll store your database's cache tables (Drupal's "cache_" tables) either in: file or memory Tip #11: Enable Drupal Cache for Anonymous Users Another one of those quick, yet powerful Drupal performance tuning steps that you can take. Tip #12: Use Squid to Cache Images and Static Content on Your Website "How to optimize Drupal for better performance?" You could go for Squid, an open-source caching proxy server. Now, since Drupal's already famed for its particularly dynamic content, the only cases where Squid does make a great performance booster are those where you need to cache static content. Tip #13: Add a Front-End Cache (i.e.Varnish Cache) Here's another handy Drupal performance optimization method for you: Use Varnish Cache to reduce the load on your server. How does it do it? It stores the HTML response, so that next time that the same page is requested, it serves it from memory. The result? Bypassed PHP and web server and... improved page load time. Tip #14: Use the Advanced CSS/JS Aggregation Module to Improve the Front-End Performance of Your Website  Combining your assets together is one of the most straightforward and effective ways to address those Drupal performance issues on your website. From: file grouping to caching to compressing ... the AdvAgg module handles all the steps that you need to take to aggregate your CSS and JS files. Tip #15: Install Memcache to Reduce Your Database Load You know how you're often struggling with keeping your database load to a minimum by caching database objects in RAM? In this respect, Memcache makes a great Drupal 8 performance optimization technique. It helps you reduce that load on the database and boost your page loading time. How? By taking standard caches out of the database. And by caching the results of resource-intensive database operations... Tip #16: Use the Entity Cache Module to Cache... Entities   Another caching best practice to boost Drupal 8 with is installing the Entity Cache module.  And its name says it all: it helps you cache entities. Tip #17: Cache Views  Here's the situation: Page requests made by registered users on your website lead to loads of queries to your database. Which impact the page load time. Now, to query the database, views are being used. And this is where this views caching module comes in handy to... boost things in there.   The END! These are our 17 recommendations for you on the best Drupal performance optimization methods for boosting your page load time. Not thrilled about the idea of having to go through the... Memcache installation process or to configure Varnish for Drupal? Or to put your current projects on hold so that your team can set up a... distributed cache? Maybe you don't have a professional Drupal maintenance team that could handle all these caching settings? We're here to help! Just drop us a line and let's figure out which of these 17 techniques are best suited for your website and the specific performance issues that it's struggling with. Let's speed things up in there! Image by Izwar Muis from Pixabay   ... Read more
Silviu Serdaru / Jun 23'2020