Latest posts

Browse topics

EU Cookie Compliance For Drupal 8 Website

I'm not an expert in EU laws, but as far as I remember since 2012 there have been passed a law, so called EU Cookie Compliance law, asking website located in the territory of European Union to provide cookie disclaimer to website visitors if any cookie installed on website. 

To play safe, I have enabled cookie information bar on my blog (you can see it in the bottom of each page)

As, recently I started Drupal 8 development on .eu domain website, which actually is hosted from EU territory I decided to wrap up a simple tutorial on best practice how to enable EU cookie compliance notification bar for Drupal 8 websites.

The good news, there is a special module to handle EU cookie directive: EU Cookie Compliance

This module intends to deal with the EU Directive on Privacy and Electronic Communications that comes into effect in the UK on 26th May 2012. From this date on, you run the risk of enforcement action if you are not compliant or visibly working towards compliance. More information can be found here: Privacy and Electronic Communications Directive 2002

The above information applies to the UK however the EU law will be enforced in all EU countries and hence the module can be used everywhere in the EU.

By enabling and configuring the module you will demonstrate to the regulator that you, as the owner of the website:

  • are doing as much as possible to reduce the amount of time before your visitors receive information about cookies (information appears as soon as a visitor enters the site).
  • are providing your visitors with options. (find out more about cookies, do not browse if you disagree).
  • ensure that the information on cookies is readily available to your visitor(visible pop-up at the bottom of the screen).
  • are visibly working towards compliance (even if you do not perform a full cookie audit, it's clear that some effort has been made).

Right, now when you are familiar how this module can help you:

Hope, it helps!

How to create related content block using taxonomy term in Drupal 8

There is no secret that related content can help to improve over all page views for website. More page views means more engaged website visitors, resulting in more sales and higher profit.

In today's Drupal tutorial I will write how to make related content block using taxonomy term field in Drupal 8. For Drupal 7 tutorial see: Related nodes based on taxonomy terms

In short, if you are already familiar how to create related content block in Drupal 7, there is no huge difference in Drupal 8. If you are new to Drupal, keep reading.

Requirements:

  • Content type with taxonomy term enabled. 

For this tutorial I will use live example from tourgeorgia.eu here we have content type Tour and attached taxonomy term field: Tour type. What we want to build is a related view listing related tours from the same category as given article, for example cultural tour.

Related taxonomy block in Drupal 8

Related taxonomy block in Drupal 8

You can see a live preview here

Drupal 8 views for related taxonomy term

Create a new content based block view - give it a nice name, Related Items (or something) add title, image and body fields to it. We will need to use 2 contextual filters. Id and Has taxonomy term id.

Configure Id filter as following:

  • Provide default value: Content ID from URL
  • Under More tab - Check next to Exclude

Configure Has taxonomy term id as following:

  • Provide default value: Taxonomy term ID from URL
  • Uncheck: Load default filter from term page
  • Check next to: Load default filter from node page, that's good for related taxonomy block
  • Multiple value handling: Filter to items that share any value
  • Check next to Reduce Duplicates
  • Under more tab check: Allow multiple values and Allow multiple values to work together.

That's it. Save your view (be sure you have created a block not page view). Now you just need to add block you just created to your sites theme region.

It is up to you have you will decide to theme your related items block. Sky is the limit for you creative work. You can add author field, date field, rating field.. so do you can add some filters to show most viewed related nodes content. In this example I gave to you, is just a basic to help you to get started for showing related item list on your Drupal powered site.

N.B. On my example Live preview from views page is not working, but it actually works when added to region in your theme.

Rainy day in Tbilisi - Time Lapse Video

That time of the year has come and as usual, in April I return to photograph that lovely brick wall opposite to our apartment, turning green. This year I decided to excel in time-lapse photography and video.

A few months ago I bought an intervalometer (around Christmas time) and today was actually the first time I put it on real action. 

I did a few tests to see how intervalometer actually works, and once get the basic understanding put it to capture 120 shots with 30-second interval (making 30 minutes in total). On-Camera settings, its manual mode, f 11, and ISO 400 (as it was a rainy day, I wanted to make it bright enough). Shot in RAW mode.

Making time-lapse videos are fun, during this 30-minute session I was able to make a coffee, upkeep some things on the blog, and do other stuff. Making this time-lapse involved using Adobe Lightroom for post-processing images, and Adobe Premiere making a video.

Adobe Lightroom

Import images to Lightroom, adjust some settings if needed, auto-sync all images, export as jpg 1920 pixels, make sure to remove the watermark

Adobe Premiere

The final comp was made in Adobe Premiere adding a sound effect (from free libraries)

I hope to apply my newly developed skills to make some nice star trails photography in the short future. My First Star Trail Photography

A tutorial for creating HDR images in Photoshop

HDR stands for High Dynamic Range, and it is a technique in which many images – usually around 3 or 5 – are merged together, so that details from all the different images show up in the final HDR image. It is simply using the dynamic range over many exposures in one single image.

[block:block=34]

Photoshop is a great and very effective tool for merging the series of photos of the same scene you have taken, to give an HDR image with lots of details and tones. In this article, I will tell you how to take photos for merging them into an HDR image, and then how to use the photos for the actual process of making an HDR image in Photoshop.

How to take source images for a final HDR image

The logic behind an HDR image is this – one single photo cannot show all the details from the highlights and the shadows. But, if we over-expose an image (make it brighter), we start getting details from the shadow region. Also, if we under-expose an image (make it darker), we get details from the highlights. What if we could do both the things together ?

HDR, in simple words, is combining an over-exposed image with an under-exposed image and a few other photos of the same scene (just for having even more detail), so that we get one single photo with multiple light levels.

So, to take the source images – the ones you'll be combining – all you have to do is take the same photo with different exposure levels.

The best way to do this is to first fix your camera on a tripod and setup your composition. You don't want your camera moving, because then there will be no similar images to merge. Also, shoot in RAW for more latitude while processing the images in Photoshop, although the method works even for JPEGs.

Once your camera is ready, take a photo that is metered by the camera itself. Not under-exposed, not over-exposed. This image is your base image, and it is basically a photo that the camera will take if it was in Auto Mode.

Now, you need at least 2 more photos to merge them all into an HDR image. Change your shutter speed to change the exposure. If you change aperture, the depth of field will change, which will make some areas of your photo unwantedly blurry. Changing ISO is also possible, but try to avoid it so that you get a clean image with no noise.

Make sure you have an under-exposed image by 1 stop at least. You can also go further and take an image under-exposed by 2 stops. Do the same the other side. Over-expose the scene by a stop, and then by one more stop.

Now, you have 2 under-exposed, 2 over-exposed, and 1 base image. You could also have done this using an 'Auto Bracketing' feature if your camera has one. More the number of images, more the information available for the final merged HDR photo.

HDR image

So, you have 5 images – or more – with different exposures, all with the same composition and still subjects. Keeping your camera stable is very important, otherwise the camera shake and movement of the subject will cause ghosting and will also make merging all images into one very tricky.

How to merge all images in Photoshop

Once you have the source images ready on your computer, you can open Photoshop and begin working on merging your images for HDR.

Merging HDR in Photoshop

Merging HDR in Photoshop

1. Open Photoshop and choose File > Automate > Merge to HDR. Here, you will get the option of choosing all your source images.

2. If in case you are unsure about camera shake and think that there is some change in the composition in the source images, select the option “Automatically Align Source Images”.

3. When you click OK, the computer will process the files and you will have to wait for a few seconds. Now, choose the 32-bit depth for the highest amount of tonal range. 8-bit and 16-bit files cannot store the entire range of light.

4. Now, the image you will see is a 32-bit preview of the final image with the source images on the side. Check for some ghosting or weird movement in the shot and if there is any, remove the source image which has the movement in it.

5. The 32-bit preview has a lot of information, most of which your computer screen cannot show. So, make sure that you save this file for later use as a 32-bit (tiff, .pbm etc) HDR full of details.

6. The merged result is a floating-point 32-bit image. You can view the available tones by sliding the White Point slider. This slider won’t change the image, it is there for you to examine the range of tones, because a monitor is incapable of displaying the whole tonal range.

7. The 32-bit image will still seem darker than you may want, but once you convert it into a 16-bit or 8-bit image, it will start to look better. You'll need to use the 8-bit image for sharing and emailing and uploading it to social media.

8. Choose Image > Mode > 8-bit. Here, you'll get options to actually bring out the exact exposure you want. You’ll see an HDR Toning Dialog box, with 2 options – Exposure and Gamma.

4. Now, the image you will see is a 32-bit preview of the final image with the source images on the side. Check for some ghosting or weird movement in the shot and if there is any, remove the source image which has the movement in it.  5. The 32-bit preview has a lot of information, most of which your computer screen cannot show. So, make sure that you save this file for later use as a 32-bit (tiff, .pbm etc) HDR full of details.  6. The merged result is a floating-point 32-bit image. You can view the available tones by sliding the White Point slider. This slider won’t change the image, it is there for you to examine the range of tones, because a monitor is incapable of displaying the whole tonal range.  7. The 32-bit image will still seem darker than you may want, but once you convert it into a 16-bit or 8-bit image, it will start to look better. You'll need to use the 8-bit image for sharing and emailing and uploading it to social media.  8. Choose Image > Mode > 8-bit. Here, you'll get options to actually bring out the exact exposure you want. You’ll see an HDR Toning Dialog box, with 2 options – Exposure and Gamma.

9. If you want an image with lots of contrast, lower the gamma. For less contrast, raise the gamma. Finally, adjust the exposure to get the desired image. There will be other options like Local Adaptation, but these are advanced tools and need another article itself.

10. If you are happy with the image, just click OK and you are done. You can also make further edits like shadows, highlights and saturation. Experiment and try to see how these settings change your image.

This is all!

Facebook Like & Share Buttons on Drupal 8 using Views

In this tutorial you will learn how to setup custom Facebook like & share buttons for Drupal 8 website using views display. No doubt, there are many great modules set and forget configuration. Though if you are looking to display functional social share buttons on views based pages, you will need to come out with custom solution. 

There are many pages and even blocks in Drupal social share buttons to be featured, like custom blocks, taxonomy pages, custom pages and so on.

For Drupal 7 see: Facebook share button for Drupal views

Here is live examples with Facebook like & share buttons I built for Drupal 8 site - tourgeorgia.eu

Custom Drupal 8 views display

Custom Drupal 8 views display with Facebook Like and Share buttons

Above you can see a custom block, featuring most popular tours on tourgeorgia.eu.

Facebook social share buttons on Drupal 8 custom pages

Facebook social share buttons on Drupal 8 custom pages

Above you can see example with social share buttons on blog page.

Here are two things you will need to take care to make Facebook like &share buttons available on Drupal 8 website

  • Add Facebook JavaScript SDK code to html.html.twig page
  • Add custom code and CSS styling to Drupal views page

Update html.html.twig page

Locate html.html.twig page in your theme folder (if you don't have one yet, create it

Visit: https://developers.facebook.com/docs/plugins/like-button#configurator and click Get Code button, you will get something like this:


<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.9&appId=YOURAPID";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

Paste following code just after opening <body> tag in html.html.twig template, make sure you enter your APP ID

Save html.html.twig

Add custom code to Drupal 8 views

I'm going to add Facebook share and like buttons, but you could fine tune it according to your needs (follow examples here: https://developers.facebook.com/docs/plugins/like-button#configurator)

Open your views display and add following code:

<div class="fb-like" data-href="{{path}}" data-layout="button_count" data-action="like" data-size="small" data-show-faces="false" data-share="true"></div>

As you can see, I've added {{path}} field for getting actual URL. When adding path field, make sure you select use absolute url, to make it work together with Facebook Open Graph

Now you can add some CSS styling to position Facebook social buttons.