Home

Web 2.0 Mirrored Images

What it Does

Provides an easy way to create 'reflected' images.

Attached Files


Web 2.0 Reflections(3 KB)

Ever wanted to create the so-called 'web 2.0' mirrored images as you can see on http://www.dio5.com/portfolio/, without having to manually rotate and proces the image? Then this one is for you.

I attached a fully working zip-package, but let's run through some of the code nonetheless.

When it comes to images the Image and GD class are the ones we need to tackle. Create a file in your mysite/code/ folder called ImageDecorator.php and add in the next code:

Create another file called MyGD.php in the same folder:

The previous code may look a bit daunting but it's basically just taking the current picture and mirrors it, after which we do a crop on it so you can add in a width & height.

To get the Image Decorator working, we'll need to add this line to our _config.php file:

The interesting part is how you can use it in your templates: $ExampleImage.getMirroredImage(300,200) will give you a mirrored image with a width of 300px and height of 200px.

Combine this with some clever use of css and a png gradient and you will be able to achieve what I did on http://www.dio5.com/portfolio/.

For those of you wanting to test this out, I provided a simple zip-package which contains a folder called 'mirrors'. Just unzip this in your root SS-folder, do a dev/build/ and you'll have an 'Example Page'-type which allows you to set an image on which this effect is demonstrated. It basically contains this html-snippet:

With this css:

Here we are adding the mirrored image as a background image on the outer container div of the 'normal' image. On the inner container div we add a black to transparent png-gradient and position the whole thing with css.

You probably want to experiment with changing the png-overlay image size & color in the zip. For a reflection on white you'll need to replace it with a white to transparent one, instead of a black one.

Hope this little snippet inspired you to do great things! Do not hesitate to ask for help or improve this where possible.

Note: I'm not adding support for IE6 here.

About the Author

Name: Dieter Orens

Website: http://www.dio5.com/portfolio/

Dieter 'dio5' Orens is a freelance web designer and developer living in Belgium.

Comments (10)

  • his service provides reflection effect for picture files hosted on your local computer or online. You can generate reflections as you like with a high level of cusotmization in height, transparency, resizing, flipping mirror effect & add rotation to the images. Even the process is carried rapid & hence this would be great. You can also check out few examples on their site which can give some idea on the way it all works.

    Posted by Free torrent files, 03/09/2010 4:50am (14 hours ago)

  • Wow thanks for that amazing article here. Web 2.0 mirrored images is something new and not well known for me. However I wish to learn them for sure. However I would like to add IE 6 support here too, so I will have to search for some code in the internet. Thanks one more time and keep publishing such nice ones in the nearest future too.

    Posted by web development, 26/08/2010 6:45am (9 days ago)


  • [url=http://www.coachoutletfactory.com/]coach outlet[/url]
    [url=http://www.suprashoes365.com/]Supra Shoes[/url]
    [url=http://www.chanelbagsoutlet.com/]chanel bags outlet[/url]

    Posted by supra shoes, 18/08/2010 7:48pm (16 days ago)

  • http://www.suprashoes365.com/
    http://www.coachoutletfactory.com/
    http://www.chanelbagsoutlet.com/


    Posted by supra shoes, 18/08/2010 7:45pm (16 days ago)

  • Thanks for sharing this This service provides reflection effect for picture files hosted on your local computer or online. You can generate reflections as you like with a high level of cusotmization in height, transparency, resizing, flipping mirror effect & add rotation to the images. Even the process is carried rapid & hence this would be great. You can also check out few examples on their site which can give some idea on the way it all works.

    Posted by watch anime, 09/08/2010 2:40pm (25 days ago)

  • o his dad and asked, "How does our boat float on the water?"Nnce again his dad replied, "Don’t know, son."Pondering his thoughts again, a short while later, the boy asks "Why is

    Posted by cheap replica handbags, 02/08/2010 3:50am (1 month ago)

  • nice post <a href="http://www.replicahandbagscheap.com/">bags</a>

    nice post <a href=http://www.replicahandbagscheap.com/>bags</a>
    [url=http://www.replicahandbagscheap.com/]bag[/url]

    Posted by www, 26/07/2010 12:55am (1 month ago)

  • A young boy and his dad went out fishing one fine morning. After a few quiet hours out in the boat, the boy became curious about the world around him. He looked up at his dad and asked "How do fish breath under water?"His dad thought about it for a moment, then replied, "I really don't know, son."The boy sat quietly from another moment, then turned back to his dad and asked, "How does our boat float on the water?"Nnce again his dad replied, "Don’t know, son."Pondering his thoughts again, a short while later, the boy asks "Why is the sky blue?"Again, his dad replied. "Don’t know, son."The inquisitive boy, worried he was annoying his father, asks this time "Dad, do you mind that I'm asking you all of these questions?""Of course not son." replied his dad, "How else are you ever going to learn anything?"

    Posted by replica watches, 06/07/2010 4:39am (2 months ago)

  • Nice sharing, clear and precise. I really like those design as use of graphics and color, as well as structure, yes those are web 2.0 design.
    God bless people like you))

    Posted by torrent basket, 23/06/2010 8:07am (2 months ago)

  • "Note: I'm not adding support for IE6 here."

    And why should you? Microsoft don't, so it's not a web designers job anymore.

    Anyone still using IE6 should be shot at dawn

    Great script btw. Excellent concept.

    Posted by Andy, 07/05/2010 6:14pm (4 months ago)

RSS feed for comments on this page RSS feed for all comments

Post your comment