Skip to content

Instantly share code, notes, and snippets.

@kamatari
Created July 7, 2014 05:44
Show Gist options
  • Save kamatari/6d213d317a17ffe4f645 to your computer and use it in GitHub Desktop.
Save kamatari/6d213d317a17ffe4f645 to your computer and use it in GitHub Desktop.
<?php
$url = "http://31.media.tumblr.com/tumblr_mc4u6lwZHr1qf4k86o1_500.jpg";
$img_string = file_get_contents($url);
$img_data = imagecreatefromstring($img_string);
// make color
$gd = imagecreatetruecolor(1,1);
$red = imagecolorallocate($gd, 255, 0, 0);
// drawing
for ($x = 1;$x<100; $x++) {
for ($y=1;$y<100;$y++) {
imagesetpixel($img_data, $x, $y, $red);
}
}
// output
imagepng($img_data, '/tmp/test.png');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment