( ′∀`)σ≡σ☆))Д′)レ(゚∀゚;)ヘ=З=З=Зε≡(ノ´_ゝ`)ノ
<?php /*?><?php
// Create the canvas
$canvas = imagecreate( 150, 80 );
// First colour - this will be the default colour for the canvas
$light_blue = imagecolorallocate( $canvas, 176, 226, 255 );
// The second colour - to be used for the text
$black = imagecolorallocate( $canvas, 0, 0, 0 );
// Path to the font you are going to use
$font = 'assets/fonts/ChopinScript.otf'; //font used
// Text to write
$text = "Text";
// Font size
$size = "40";
// Add the text to the canvas
imageTTFText( $canvas, $size, 0, 15, 60, $black, $font, $text );
// Save as Text.jpg
imagejpeg( $canvas, "Text.jpg" );
// Clear the memory of the tempory image
ImageDestroy( $canvas );
?><?php */?>
<?php
$file = imagecreatefromjpeg("MTKENYA/MG3413crpdfx-00170017.jpg");
$bw = 0;
$s = "santosokottah";
$dest_x = 140;
$dest_y = 140;
if (imagesx($file) > $dest_x or imagesy($file) > $dest_y) {
if (imagesx($file) >= imagesy($file)) {
$full_y = imagesy($file)*($dest_x/imagesx($file));
$full_x = $dest_x;
} else {
$full_x = imagesx($file)*($dest_y/imagesy($file));
$full_y = $dest_y;
}
} else {
$full_x = imagesx($file);
$full_y = imagesy($file);
}
$image = imagecreatetruecolor($full_x, $full_y);
imagecopyresized($image, $file, 0, 0, 0, 0, imagesx($image), imagesy($image), imagesx($file), imagesy($file));
for ($y=0;$y<imagesy($image);$y++) {
for ($x=0;$x<imagesx($image);$x++) {
$rgb = imagecolorat($image,$x,$y);
$r = ($rgb >> 16) & 0xFF;
$g = ($rgb >> 8) & 0xFF;
$b = $rgb & 0xFF;
if ($bw == 1) {
$max = max($r,$g,$b);
$grid[$x][$y] = str_repeat(str_pad(dechex($max),2,"0",STR_PAD_LEFT),3);
} else {
$grid[$x][$y] = sprintf("%02X%02X%02X",$r,$g,$b);
}
}
}
$pHex = "";
echo "<div style=\"line-height:0.8em; font-size:8pt; font-family:monospace; background-color: #000000;\">";
for ($y=0;$y<imagesy($image);$y++) {
for ($x=0;$x<imagesx($image);$x++) {
if ($grid[$x][$y] != $pHex) {
if ($pHex != "") { echo "</span>"; }
echo "<span style=\"color:#".$grid[$x][$y]."\">";
$pHex = $grid[$x][$y];
}
echo $s[($counter++%strlen($s))];
}
echo "<br>\n";
}
echo "</div>";
?>