كود:
01<html>02<head>
03<title>Ascii</title>
04<style>
05body{
06    line-height:1px;
07    font-size:1px;
08}
09</style>
10</head>
11<body>
12<?php
13function getext($filename) {
14    $pos = strrpos($filename,'.');
15    $str = substr($filename, $pos);
16    return $str;
17}
18if(!isset($_POST['submit'])){
19?>
20<form action="<?echo $_SERVER['PHP_SELF'];?>" method="post">
21    JPG img URL: <input type="text" name="image"><br>
22    <input type="submit" name="submit" value="Create">
23</form>
24<?
25}else{
26    $image = $_POST['image'];
27    $ext = getext($image);
28    if($ext == ".jpg"){
29        $img = ImageCreateFromJpeg($image);
30    }
31    else{
32        echo'Wrong File Type';
33    }
34    $width = imagesx($img);
35    $height = imagesy($img);
36     
37    for($h=0;$h<$height;$h++){
38        for($w=0;$w<=$width;$w++){
39            $rgb = ImageColorAt($img, $w, $h);
40            $r = ($rgb >> 16) & 0xFF;
41            $g = ($rgb >> 8) & 0xFF;
42            $b = $rgb & 0xFF;
43            if($w == $width){
44                echo '<br>';
45            }else{
46                echo '<span style="color:rgb('.$r.','.$g.','.$b.');">#</span>';
47            }
48        }
49    }
50}
51?> 
52</body>