![]() |
Image Reflections in PHP
Now this is a pretty simple tutorial on how to create a nice simple reflection on images. This won't show you how to make little ripples just yet.
You can view an example of what this script can do. HERE Firstly we need to define the image we are reflecting and get its size. (Width & Height) PHP Code:
PHP Code:
PHP Code:
PHP Code:
PHP Code:
PHP Code:
PHP Code:
PHP Code:
PHP Code:
In a new file. Place the full size image you want to reflect on the page and under that image, place the following code. PHP Code:
|
Awesome! This was one of THE tutorials I have been waiting for!
Thanks mate! |
Your welcome :-)
|
Next to this, is there also a way to modify is the was Techzine did it? Like giving the image a gradient (wet floor) effect in the same image? You've got 2 images right now with a small white line.
|
Any chance you can put up a before and after image? :-) Save me copying down all the code. Apart from the absence of an after image though, it reads very well! Very useful!
|
Indeed it does. I am getting an error at the moment. Simply no image is showing up. I named the file image.php and the file that I am echo'ing it in pic.php.
Doesn't seem to be working, or I miscopied the code. My current script: PHP Code:
|
Post an after image, Respawn! :-)
|
Will do Honey!
My Code: image.php PHP Code:
PHP Code:
![]() Result: ![]() |
Yeah at the moment it creates a new image, but i am working on a class that will create it as one image :-) hopefully.
|
Oh now that is smart! Even got the gradient there which is impressive stuff.
|
It really is! What would be even more awesome, is to intergrade it like this.
1. You upload an image, let's stay, a wallpaper. 2. The script creates a thumb to display on the frontpage. 3. Your script, gives it the extra designerstyle edge by creating a wet-floor effect and creating a seperate image. - You've got 3 images right now. The uploaded original, the thumb and your version. 4. Your script saves the file OVER (overwrite) the thumb and finito! You've got a thumbnail with a wet-floor effect. Would be a nice project huh? If you need any help, I'm all yours (for what I CAN do). |
Yes indeed that sounds like a good project and i am up for giving it a shot. If you have any MSN or something like that let me know, so you are able to help that way. :-)
|
Yeah I do. :-) Feel free to add me @ markernstproductions@gmail.com.
Noticed that you're UK, so our time diffirence is only 1 hour I believe (GTM+1 here). Tell me what to do and let's get crackin'. I'm new to the whole image thing in PHP, so that's going to be a challenge. BUT I am up for it! |
If you check out my website now i have updated it using the image reflection as it just gave me such a great idea lol.
The images at the top will change everytime, sometimes displays the same image, but still working on that lol. http://www.dalemooney.com/ |
Ah very nice Dale, looks very professional. I like it a lot.
|
Thanks! I tried it already :-) I love it.
|
Transparent
I find it incredible that no one asked this by now.
What about instead of the white color to use a transparent color? How can I do this? And of course to save it as png. Thanks. |
Hi, I found this but when I test it I see only a black image?
<?php // show the correct header for the image type header("Content-type: image/jpg"); // an email address in a string $string = "email@example.com"; // some variables to set $font = 4; $width = ImageFontWidth($font) * strlen($string); $height = ImageFontHeight($font); // lets begin by creating an image $im = @imagecreatetruecolor ($width,$height); //white background $background_color = imagecolorallocate ($im, 255, 255, 255); //black text $text_color = imagecolorallocate ($im, 0, 0, 0); // put it all together imagestring ($im, $font, 0, 0, $string, $text_color); // and display imagejpeg ($im); ?> |
| All times are GMT. The time now is 09:05 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0