Last active
December 5, 2018 14:42
-
-
Save CompSciRocks/888af3826331ebc327a214bfb56a396b to your computer and use it in GitHub Desktop.
Tiny script to create solid color images using PHP and GD Library for https://colorswatches.info - blog post at https://compsci.rocks/solid-color-image-in-php/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$red = 100; | |
$blue = 150; | |
$green = 200; | |
$my_img = imagecreate( 1000, 1000 ); | |
$background = imagecolorallocate( $my_img, $red, $green, $blue ); | |
header( "Content-type: image/png" ); | |
imagepng( $my_img ); | |
imagecolordeallocate( $my_img, $background ); | |
imagedestroy( $my_img ); | |
die(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment