<span style=
"color: #000000;"
>php </span><span style=
"color: #0000ff;"
>
class
</span><span style=
"color: #000000;"
> Image{ </span><span style=
"color: #0000ff;"
>
private
</span><span style=
"color: #000000;"
>
$info
; </span><span style=
"color: #0000ff;"
>
private
</span><span style=
"color: #000000;"
>
$image
; </span><span style=
"color: #0000ff;"
>
public
</span><span style=
"color: #000000;"
>
$type
; </span><span style=
"color: #0000ff;"
>
public
</span><span style=
"color: #000000;"
>
function
__construct(
$src
) { $</span><span style=
"color: #0000ff;"
>this</span>->info=<span style=
"color: #000000;"
>
getimagesize
(
$src
); $</span><span style=
"color: #0000ff;"
>this</span>->type=image_type_to_extension($<span style=
"color: #0000ff;"
>this</span>->info[<span style=
"color: #800000;"
>
'</span><span style="color: #800000;">2</span><span style="color: #800000;">'
</span>],<span style=
"color: #0000ff;"
>false</span><span style=
"color: #000000;"
>);
$fun
</span>=<span style=
"color: #800000;"
>
"</span><span style="
color: #800000;
">imagecreatefrom{$this->type}</span><span style="
color: #800000;
">"
</span><span style=
"color: #000000;"
>; $</span><span style=
"color: #0000ff;"
>this</span>->image=<span style=
"color: #000000;"
>
$fun
(
$src
); } </span><span style=
"color: #008000;"
>
</span> <span style=
"color: #0000ff;"
>
public
</span>
function
fontMark(
$font
,
$content
,
$size
,
$col
,
$location
,
$angle
=<span style=
"color: #800080;"
>0</span><span style=
"color: #000000;"
>){
$col
</span>=imagecolorallocatealpha($<span style=
"color: #0000ff;"
>this</span>->image,
$col
[<span style=
"color: #800000;"
>
'</span><span style="color: #800000;">0</span><span style="color: #800000;">'
</span>],
$col
[<span style=
"color: #800000;"
>
'</span><span style="color: #800000;">1</span><span style="color: #800000;">'
</span>],
$col
[<span style=
"color: #800000;"
>
'</span><span style="color: #800000;">2</span><span style="color: #800000;">'
</span>],
$col
[<span style=
"color: #800000;"
>
'</span><span style="color: #800000;">3</span><span style="color: #800000;">'
</span><span style=
"color: #000000;"
>]); imagettftext($</span><span style=
"color: #0000ff;"
>this</span>->image,
$size
,
$angle
,
$location
[<span style=
"color: #800000;"
>
'</span><span style="color: #800000;">0</span><span style="color: #800000;">'
</span>],
$location
[<span style=
"color: #800000;"
>
'</span><span style="color: #800000;">1</span><span style="color: #800000;">'
</span><span style=
"color: #000000;"
>],
$col
,
$font
,
$content
); } </span><span style=
"color: #008000;"
>
</span> <span style=
"color: #0000ff;"
>
public
</span><span style=
"color: #000000;"
>
function
imageMark(
$imageMark
,
$dst
,
$pct
){
$info2
</span>=<span style=
"color: #000000;"
>
getimagesize
(
$imageMark
);
$type
</span>=image_type_to_extension(
$info2
[<span style=
"color: #800000;"
>
'</span><span style="color: #800000;">2</span><span style="color: #800000;">'
</span>],<span style=
"color: #0000ff;"
>false</span><span style=
"color: #000000;"
>);
$func2
</span>=<span style=
"color: #800000;"
>
"</span><span style="
color: #800000;
">imagecreatefrom</span><span style="
color: #800000;
">"
</span><span style=
"color: #000000;"
>.
$type
;
$water
</span>=<span style=
"color: #000000;"
>
$func2
(
$imageMark
); imagecopymerge($</span><span style=
"color: #0000ff;"
>this</span>->image,
$water
,
$dst
[<span style=
"color: #800080;"
>0</span>],
$dst
[<span style=
"color: #800080;"
>1</span>], <span style=
"color: #800080;"
>0</span>, <span style=
"color: #800080;"
>0</span>,
$info2
[<span style=
"color: #800000;"
>
'</span><span style="color: #800000;">0</span><span style="color: #800000;">'
</span>],
$info2
[<span style=
"color: #800000;"
>
'</span><span style="color: #800000;">1</span><span style="color: #800000;">'
</span><span style=
"color: #000000;"
>],
$pct
); imagedestroy(
$water
); } </span><span style=
"color: #008000;"
>
</span> <span style=
"color: #0000ff;"
>
public
</span><span style=
"color: #000000;"
>
function
thumb(
$thumbSize
){
$imageThumb
</span>=imagecreatetruecolor(
$thumbSize
[<span style=
"color: #800080;"
>0</span>],
$thumbSize
[<span style=
"color: #800080;"
>1</span><span style=
"color: #000000;"
>]); imagecopyresampled(
$imageThumb
, $</span><span style=
"color: #0000ff;"
>this</span>->image, <span style=
"color: #800080;"
>0</span>, <span style=
"color: #800080;"
>0</span>, <span style=
"color: #800080;"
>0</span>, <span style=
"color: #800080;"
>0</span>,
$thumbSize
[<span style=
"color: #800080;"
>0</span>],
$thumbSize
[<span style=
"color: #800080;"
>1</span>], $<span style=
"color: #0000ff;"
>this</span>->info[<span style=
"color: #800000;"
>
'</span><span style="color: #800000;">0</span><span style="color: #800000;">'
</span>], $<span style=
"color: #0000ff;"
>this</span>->info[<span style=
"color: #800000;"
>
'</span><span style="color: #800000;">1</span><span style="color: #800000;">'
</span><span style=
"color: #000000;"
>]); imagedestroy($</span><span style=
"color: #0000ff;"
>this</span>-><span style=
"color: #000000;"
>image); $</span><span style=
"color: #0000ff;"
>this</span>->image=<span style=
"color: #000000;"
>
$imageThumb
; } </span><span style=
"color: #008000;"
>
</span> <span style=
"color: #0000ff;"
>
public
</span><span style=
"color: #000000;"
>
function
cut(
$cutSize
,
$location
){
$imageCut
</span>=imagecreatetruecolor(
$cutSize
[<span style=
"color: #800080;"
>0</span>],
$cutSize
[<span style=
"color: #800080;"
>1</span><span style=
"color: #000000;"
>]); imagecopyresampled(
$imageCut
, $</span><span style=
"color: #0000ff;"
>this</span>->image, <span style=
"color: #800080;"
>0</span>, <span style=
"color: #800080;"
>0</span>,
$location
[<span style=
"color: #800080;"
>0</span>],
$location
[<span style=
"color: #800080;"
>1</span>],
$cutSize
[<span style=
"color: #800080;"
>0</span>],
$cutSize
[<span style=
"color: #800080;"
>1</span>],
$cutSize
[<span style=
"color: #800080;"
>0</span>],
$cutSize
[<span style=
"color: #800080;"
>1</span><span style=
"color: #000000;"
>]); imagedestroy($</span><span style=
"color: #0000ff;"
>this</span>-><span style=
"color: #000000;"
>image); $</span><span style=
"color: #0000ff;"
>this</span>->image=<span style=
"color: #000000;"
>
$imageCut
; } </span><span style=
"color: #008000;"
>
</span> <span style=
"color: #0000ff;"
>
public
</span><span style=
"color: #000000;"
>
function
show(){ header(</span><span style=
"color: #800000;"
>
"</span><span style="
color: #800000;
">content-type:</span><span style="
color: #800000;
">"
</span>.$<span style=
"color: #0000ff;"
>this</span>->info[<span style=
"color: #800000;"
>
'</span><span style="color: #800000;">mime</span><span style="color: #800000;">'
</span><span style=
"color: #000000;"
>]);
$funn
</span>=<span style=
"color: #800000;"
>
"</span><span style="
color: #800000;
">image</span><span style="
color: #800000;
">"
</span>.$<span style=
"color: #0000ff;"
>this</span>-><span style=
"color: #000000;"
>type;
$funn
($</span><span style=
"color: #0000ff;"
>this</span>-><span style=
"color: #000000;"
>image); } </span><span style=
"color: #008000;"
>
</span> <span style=
"color: #0000ff;"
>
public
</span><span style=
"color: #000000;"
>
function
save(
$newname
){ header(</span><span style=
"color: #800000;"
>
"</span><span style="
color: #800000;
">content-type:</span><span style="
color: #800000;
">"
</span>.$<span style=
"color: #0000ff;"
>this</span>->info[<span style=
"color: #800000;"
>
'</span><span style="color: #800000;">mime</span><span style="color: #800000;">'
</span><span style=
"color: #000000;"
>]);
$funn
</span>=<span style=
"color: #800000;"
>
"</span><span style="
color: #800000;
">image</span><span style="
color: #800000;
">"
</span>.$<span style=
"color: #0000ff;"
>this</span>-><span style=
"color: #000000;"
>type;
$funn
($</span><span style=
"color: #0000ff;"
>this</span>->image,
$newname
.<span style=
"color: #800000;"
>
'</span><span style="color: #800000;">.</span><span style="color: #800000;">'
</span>.$<span style=
"color: #0000ff;"
>this</span>-><span style=
"color: #000000;"
>type); } </span><span style=
"color: #0000ff;"
>
public
</span><span style=
"color: #000000;"
>
function
__destruct(){ imagedestroy($</span><span style=
"color: #0000ff;"
>this</span>-><span style=
"color: #000000;"
>image); } } </span>?>