Jump to content

Recommended Posts

Posted

I didn't write this. I had it saved from a few years back and came across it last night and thought some of you might like the effect. Takes an image like this:

 

 

and reflects it like this:

 

 

<?php
# Read the image
$im = new Imagick("../../images/heliohost.png");

# Clone the image and flip it
$reflection = $im->clone();
$reflection->flipImage();

# Create gradient. It will be overlayd on the reflection
$gradient = new Imagick();

# Gradient needs to be large enough for the image 
$gradient->newPseudoImage($reflection->getImageWidth(), $reflection->getImageHeight(), "gradient:transparent-black");

# Composite the gradient on the reflection 
$reflection->compositeImage($gradient, imagick::COMPOSITE_OVER, 0, 0);

# Add some opacity. Requires ImageMagick 6.2.9 or later 
$reflection->setImageOpacity( 0.3 );

# Create an empty canvas 
$canvas = new Imagick();

# Canvas needs to be large enough to hold the both images 
$width = $im->getImageWidth();
$height = ($im->getImageHeight() * 2);
$canvas->newImage($width, $height, new ImagickPixel("black"));
$canvas->setImageFormat("png");

# Composite the original image and the reflection on the canvas 
$canvas->compositeImage($im, imagick::COMPOSITE_OVER, 0, 0);
$canvas->compositeImage($reflection, imagick::COMPOSITE_OVER, 0, $im->getImageHeight());

# uncomment to write image to your directory
# $canvas->writeimage("reflected.png");

# output image
header("Content-Type: image/png");
echo $canvas;
?>

 

Posted
I didn't write this. I had it saved from a few years back and came across it last night and thought some of you might like the effect. Takes an image like this:

 

 

and reflects it like this:

 

That's really cool. Much easier than adding reflections in the gimp or photoshop or whatever like I have always done in the past. I haven't actually tried it yet, but what is the deal with the mouse cursor? Just happened to have it sitting there when the screen shot was taken or something?

Posted

Those are the actual png images the script creates and not screen shots. Maybe you've mistaken the arrow in the image for the curser?

 

btw, if your interested in imaging, check out what we can do with the Imagick Class.

 

http://byrondallas.heliohost.org/php/imagi...all-methods.php

 

If you'll click onto the link that says DJ Mike's examples, you'll find more examples there than at php.net.

 

 

Posted
Those are the actual png images the script creates and not screen shots. Maybe you've mistaken the arrow in the image for the curser?

Yeah, there is an arrow in the background pointed towards the top right, but am I the only one that sees the mouse pointer arrow pointed straight at Tux's chest? :blink: That's why I asked if it was a screenshot. I just figured you took a screenshot to make the original image rather than saving the image.

btw, if your interested in imaging, check out what we can do with the Imagick Class.

 

http://byrondallas.heliohost.org/php/imagi...all-methods.php

 

If you'll click onto the link that says DJ Mike's examples, you'll find more examples there than at php.net.

Yep, very good information in there. I followed that link back when you posted the rainbow swirly text script http://www.helionet.org/index/index.php?showtopic=9136 which is also very cool.

Guest Geoff
Posted
Yeah, there is an arrow in the background pointed towards the top right, but am I the only one that sees the mouse pointer arrow pointed straight at Tux's chest? That's why I asked if it was a screenshot. I just figured you took a screenshot to make the original image rather than saving the image.

 

Someone created that logo for us, but we didn't use it because it did not look as good as our current logo.

Posted
Yeah, there is an arrow in the background pointed towards the top right, but am I the only one that sees the mouse pointer arrow pointed straight at Tux's chest? That's why I asked if it was a screenshot. I just figured you took a screenshot to make the original image rather than saving the image.

Someone created that logo for us, but we didn't use it because it did not look as good as our current logo.

Ok, I guess that explains it. I like the logos that are in use better than this one too. -_-

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...