Tuesday, 2 August 2011

Image Protection: CSS Image Layering

Unlike my last post this example of image protection uses the z-index property to place a transparent image on top of the image you want showcased.

What did I want to achieve by this and what other resources did I use?

(1) Saving the image by right clicking will only save the transparent image
(2) Google’s URL shortener was used to convert the normal image addresses
(3) The benefits of URL shortening are detailed here
(4) Low resolution images
(5) No click link to a larger image

Mouse Trap

Before I forget, many thanks to MediaCollege.com: Free video, audio and electronic media resources, who I looked to for guidance as I went about trying to replicate their example.

Now, while web feed results were a mixed punch it appears I’ve overcome a few hurdles in getting it right here.

First hurdle:

Formatting a centered HTML table and inserting into this two images (one transparent and the other the image above) inside a div. They were then positioned using CSS, and the transparent image with its greater z-index number being placed on top of the mousetrap image. (see code below)

Second hurdle:

My blog HTML gives post images the background colour of my post area. This gave my transparent image a background colour which hid the image I wanted visible. (see bolded text)

.post img { margin: 5px; padding: 5px; background: #f0f0e9; border: 1px solid #f0f0e9; }

This was overcome by giving the transparent image a transparent background in my code (see code below).

Third hurdle:

My level of CSS skill and all things like that in general.

A gentle reminder

For us bloggers it’s impossible to prevent images from being copied. The good news is that we can make things hard for novices.

Open Source Code

<br /> <table style="margin: 0px auto" border="0" cellspacing="0" cellpadding="0" align="center" border-spacing="0"><tbody> <tr> <td> <div style="width: 462px; height: 234px"><img style="z-index: 300; position: absolute; padding-bottom: 0px; margin: 0px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; padding-top: 0px" src="http://goo.gl/vmpws" width="462" height="234" /><img style="z-index: 3000; position: absolute; text-align: center; padding-bottom: 0px; margin: 0px auto; padding-left: 0px; padding-right: 0px; display: block; background: none transparent scroll repeat 0% 0%; float: none; padding-top: 0px" title="Mouse Trap" border="0" alt="Mouse Trap" src="http://goo.gl/HpLJx" width="462" height="234" /></div> </td> </tr> </tbody></table> <br />

Other Open Source Image Posts:
Article link
Image Slicing and URL Shortening
Article link
LinkWithin Alternative Howzat
Article link
LinkWithin Alternative Howzat Part II
Atom/RSS
Atom/RSS
Atom/RSS

5 comments - care to make one?:

Max Coutinho 3.8.11  

Peter,

Do you know for how long I was looking for a post like this? Sure, there are many posts teaching how to layer images; but their language does not reach computer-illiterates/computer-impatient, such as myself. So, thank you!

I'll save it and hopefully I will be able to follow the instructions in the future.

Cheers

La Petite Gallery 3.8.11  

I am 75 and it's over my head. I wish I was better at this. Good luck.

yvonne

Peter 12.8.11  

Hi Max. Sorry for the late reply. My mind is elsewhere at the moment.

Posts like these take me forever to get right. I hope it helps someone, but as I said, images are impossible to protect.

Take Care,
Peter

Peter 12.8.11  

Hi Yvonne. Same goes for Max's comment, sorry about the late reply. You are doing a great job of blogging and I hope to be still blogging at the age of 75.

Take Care,
Peter

Max Coutinho 17.8.11  

Peter,

Don't apologise: I know how it goes. You reply whenever you feel like it.

"Posts like these take me forever to get right. I hope it helps someone, but as I said, images are impossible to protect."

I can imagine. I get your message, mate!

Cheers

Post a Comment


WELCOME TO ALL THAT COME HERE

Hi! Thank you for visiting and I hope you enjoyed your visit. Comments are welcomed and would be greatly appreciated, as I would really like to hear what you have to say!

Note: Comments are moderated and will be published later. Anyone having trouble with comments while using Internet Explorer should try using another web browser such as Google Chrome or Firefox.

Take Care,
Peter McCartney
Sydney Australia

  © Free Blogger Templates Spain by Ourblogtemplates.com 2008 / Header Image Credit - Athaydesbr

Back to TOP