( ′∀`)σ≡σ☆))Д′)レ(゚∀゚;)ヘ=З=З=Зε≡(ノ´_ゝ`)ノ HEX
HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux mail.thebrand.ai 6.8.0-107-generic #107-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 13 19:51:50 UTC 2026 x86_64
User: www-data (33)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: /var/www/html/gradient.php
<?php  
/**
 *Gradient function by http://codingforums.com/showthread.PHP?t=79463 Much thanks to user "Jak-s".
 *Documentation added by Drew Douglass
 *
 *@param string $hexstart is the hex color to start at 
 *@param string $hexend is the hex color to end at 
 *@param int steps is the number of steps (or length) of the gradient 
 *@return array $gradient returns an array of all the color values 
 *
 *See bottom for usage. 
 */
ini_set("display_errors", "1");
error_reporting(E_ALL); 
 
function gradient($hexstart, $hexend, $steps) {
 
	//Find the start red, green, and blue values
	//See http://us2.PHP.net/manual/en/function.hexdec.PHP for more info 
    $start['r'] = hexdec(substr($hexstart, 0, 2));
    $start['g'] = hexdec(substr($hexstart, 2, 2));
    $start['b'] = hexdec(substr($hexstart, 4, 2));
 
	//Find the end of the red, green, and blue values
    $end['r'] = hexdec(substr($hexend, 0, 2));
    $end['g'] = hexdec(substr($hexend, 2, 2));
    $end['b'] = hexdec(substr($hexend, 4, 2));
 
    //Calculate steps for each color value 
    $step['r'] = ($start['r'] - $end['r']) / ($steps - 1);
    $step['g'] = ($start['g'] - $end['g']) / ($steps - 1);
    $step['b'] = ($start['b'] - $end['b']) / ($steps - 1);
 
    $gradient = array();
 
    ///Loop through each color depending on steps 
    for($i = 0; $i <= $steps; $i++) {
 
        $rgb['r'] = floor($start['r'] - ($step['r'] * $i));
        $rgb['g'] = floor($start['g'] - ($step['g'] * $i));
        $rgb['b'] = floor($start['b'] - ($step['b'] * $i));
 
        $hex['r'] = sprintf('%02x', ($rgb['r']));
        $hex['g'] = sprintf('%02x', ($rgb['g']));
        $hex['b'] = sprintf('%02x', ($rgb['b']));
 
        $gradient[] = implode(NULL, $hex);
 
    }
 
    return $gradient;
 
}
 
/**
  *Example usage with a LOT of divs
  *Dont you ever do this on a clients website ;-) 
  */
$gradient = gradient('4096EE', 'C3D9FF', 50);
 
foreach($gradient as $color){
	echo '<div style="background-color:'.$color.';">&nbsp;</div>';
}?>



3. Watermark that cat!

Now, we don't just want people downloading pictures of our cute little kitty and claiming it as their own, so we need to protect the image. One way to discourage image theft is to watermark the image on the server side. This will require a few things. One, we will need a source image, which is our kitten. Next, we need a watermark image, I have chosen a simple transparent .gif with some ThemeForest text as the image. Lastly, we need to merge the watermark onto the image. In addition, we want to be able to specify the opacity as well as the padding and position of the watermark, relative to the image. Sound like a lot of work? It's not!

<?php ini_set("display_errors", "1");
error_reporting(E_ALL); 
 
//Set up some basic variables and locations 
$image_src = 'guido_the_kitten.jpg';
$watermark_src = 'watermark.gif';
$opacity = 30;
$padding = 20;
 
//Load our images 
$image = imagecreatefromjpeg($image_src);
$watermark = imagecreatefromgif($watermark_src);
 
//Grab and store the height and width of our images 
list($image_width, $image_height) = getimagesize($image_src);
list($watermark_width, $watermark_height) = getimagesize($watermark_src);
 
//Set the final location of our watermark depending on the padding and size 
$final_x = $image_width - $watermark_width - $padding;
$final_y = $image_height - $watermark_height - $padding;
 
//Copy our watermark onto the original image 
imagecopymerge($image, $watermark, $final_x, $final_y, 0, 0, $watermark_width, $watermark_height, $opacity);
 
//Set headers, print image, clear memory 
header("Content-type: image/jpeg");
imagejpeg($image, null, 100);
imagedestroy($image);
imagedestroy($watermark);?>