Including inline images in Backlight Copy areas

(this is an updated version of my original tutorial way back in the CE3 days)

In all Backlight Copy areas, (in pages, albums, album sets, and album and album set templates) you can add images to the text by using html. If you know some html this is easy. If you don’t, you’re probably starting to sweat right now. But it’s not that difficult and I’ll walk you through the basics.

The basic html to include an image in any html document looks like this:

<img src="/path-to-image/your-image.jpg" alt="descriptive text">

Pretty simple, right? Just place that code in the Copy (md) text block where you want it to appear.

Let’s look at that more closely. The <img> tag tells the browser that this is an image. src= tells the browser where to look for the image. the alt attribute adds information in the event that the image can’t be displayed for some reason or if the viewer is using a screen reader.

My suggestion for adding inline images to pages is to create a folder on the server and upload the images you want to use to that folder. You could use the Backlight image uploader (Designer > Templates > Upload Images) but I discourage that. The uploader is intended for things like logos, background images, favicons, etc. It will change the filename and strip the image of metadata.

My workflow is to export the images from Lightroom and then upload them via FTP to a folder in my site that I named “img.” The best place to create that folder is inside of your /backlight/custom/ folder.

With that in mind, my code would look like this:

<img src="/backlight/custom/img/my-image.jpg" alt="descriptive text">

This code assumes that the backlight/ folder is in the root of your site or subdomain. If it’s in a sub-folder, then adjust the path accordingly.

Now we can really get going.

First, let’s control the size. Your image may have been exported at 1000px wide but maybe you only want it to be 300px wide on the page. That’s easy, just add the width attribute:

<img src="path-to-image/your-image.jpg" width="300" alt="descriptive text">

Floating images

Matt has included css classes that will float images right, left, or center and adds margin that places a bit of space between the image and surrounding text. These class names are the same as those used in WordPress so if you have a blog and are using the Backlight WordPress theme, you can use the same classes.

This will float the image to the left with text wrapping to the right of the image.

<img src="path-to-image/your-image.jpg" width="300" class="alignleft" alt="descriptive text">

The other classes are “alignright”, “aligncenter”, and “alignnone”.

Title and styling

If you want your viewers to be able to hover over the image and see some information about it, add the title attribute:

<img src="path-to-image/your-image.jpg" width="300" class="alignleft" title="some descriptive text" alt="descriptive text">

Want to add some styling, like a border?

<img src="path-to-image/your-image.jpg" width="300" class="alignleft" style="border: 2px red solid;" title="some descriptive text" alt="descriptive text" >

This styling will place a 2px wide red border directly around the image.

Include your text

The text and image code for the entire page would look something like this:

 

Add a link

Do you want your viewers to be able to click on an image and be taken to another page? Then just wrap the entire <img> tag in an html anchor element:

<a href="http://www.another-site.com"><img src="path-to-image/your-image.jpg" width="300" class="alignleft" alt="some descriptive text" title="More descriptive text" style="border: 2px red solid;"></a>

More styling and adding classes

There’s even more you can do if you wish, like adding drop shadows. You can do this either by adding the code inline with the image, create a custom css class and applying it on an as needed basis, or applying it to all inline images automatically via custom css.

Clearing the float

You’ll eventually come across a situation where you want the text to stop floating around an image. The answer is the “clear” property. Just add the clear property as inline styling at the start of the text you wish to clear from the float. If you were floating the image to the left, use clear:left;. If floating to the right, use clear:right;. If you’ve mixed things up a bit with pictures floating both left and right, then use clear: both;.

If it’s a paragraph, then add the clear to the p tag that starts the paragraph:

<p style="clear:left;">Your witty prose....</p>

If it’s a heading, add the clear to the heading element:

<h2 style="clear:left;">Your eye catching heading</h2>

3 thoughts on “Including inline images in Backlight Copy areas”

  1. Thanks Rod – wish you would have posted this a few years ago. It would have saved me from learning enough html to do it on my own for styling some of my web pages, but it is a very effective way to improve the page style. I use it on a few of my web pages and it really is quite simple once you get the hang of it.

      1. I started with LR1 and never thought to look back at the CE3 for ideas – but the experience was a good brain exercise for me. Actually took me back over 40 years to a time I taught myself to program in Basic and Fortran – computer languages have come a long way since then. 🤓

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About this site

This site is: a repository of time-savers and best practices from a user's perspective, picked up from several years of using TTG plugins.
This site is not: a support site.
Read more here.

Subscribe to new posts

Tip Jar

If this site has saved you some time, kept your hair attached, or otherwise prevented you from tossing the mouse through the monitor, feel free to donate.

Categories


Highly recommended. This is my go-to Lightroom book. Click on the book image. (affiliate link)

Affiliate link!

Current TTG versions

Backlight  4 & 5

See the Backlight Modules page on your site for latest Backlight and module versions and changelogs.

You’ll also find the latest version number and download link for the Lightroom Publisher plugin.
(BL 3 and later)

 

Backlight 1 Versions

Backlight 1.2.4
Pages module 1.2.4
Cart Add-on 4.1.7
Client Response Add-on 7.1.3
Theater Add-on 1.2.6
Galleria Add-on 1.0.0
WordPress Add-on 1.2.6
Publisher 3.2.3

Backlight 1 has seen its end of life. See this post.

CE4 Versions

note: CE4 is no longer being developed or sold. See this post.

TTG-BE: 2.0.5a
Autoindex: 7.0.8
Cart: 3.1.4a
CRG: 6.1.3a
Gallery: 6.1.10
Pages: 7.0.15
Publisher: 2.3.3
Stage: 6.1.6
Theme for WordPress: 3.1.2