имеется скрипт:
| Код | <? include("langsettings.php"); ?> <? $text=$_REQUEST['text']; if($text=="") $text="Theodore is here.. Pedro never die!"; if($_REQUEST['img']!=1) { ?> <html> <head> <link href="test.css" rel="stylesheet" type="text/css"> <title></title> </head> <body> <p> <h1><?php echo $TEXT['iart-head']; ?></h1> <img width="915" height="254" src="iart.php?img=1&text=<?=urlencode($text)?>" alt=""><p class="small"> <?=$TEXT['iart-text1']?> </body> </html> <? exit; }
$fontfile="/opt/htdocs/AnkeCalligraph.TTF";
$size=9; $h=254; $w=915;
$im = ImageCreate ( $w, $h );
$fill = ImageColorAllocate ( $im , 251, 121, 34 ); $light = ImageColorAllocate ( $im, 255, 255, 255 ); $corners = ImageColorAllocate ( $im , 153 , 153 , 102 ); $dark = ImageColorAllocate ( $im , 51, 51 , 0 ); $black = ImageColorAllocate ( $im , 0, 0 , 0 );
$colors[1] = ImageColorAllocate ( $im , 255 , 255 , 255 ); $colors[2] = ImageColorAllocate ( $im , 255*0.95 , 255*0.95 , 255*0.95 ); $colors[3] = ImageColorAllocate ( $im , 255*0.9 , 255*0.9 , 255*0.9 ); $colors[4] = ImageColorAllocate ( $im , 255*0.85 , 255*0.85 , 255*0.85 );
header("Content-Type: image/png");
srand(time()); $c=1; $anz=10; $step=4/$anz; for($i=0;$i<$anz;$i+=1) { $size=rand(7,70); $x=rand(-390,390); $y=rand(-100,400); $color=$colors[$c]; $c+=$step; ImageTTFText ($im, $size, 0, $x, $y, $color, $fontfile, $text); }
ImageLine ( $im , 0 ,0, $w-1, 0, $light ); ImageLine ( $im , 0 ,0, 0, $h-2, $light ); ImageLine ( $im , $w-1,0, $w-1, $h, $dark ); ImageLine ( $im , 0 ,$h-1, $w-1, $h-1, $dark ); ImageSetPixel ( $im , 0 ,$h-1, $corners ); ImageSetPixel ( $im , $w-1 ,0, $corners );
ImagePNG ( $im ); ?>
|
Ефект скрипта:

вопрос состоит в том:
как можно сделать чтобы текстура на картинке была того же размера что и картинка? в случае если размер картинки 100% всё работает, если текстура 100% выдаёт error.
PS! Текстура: я так назвал для себя генератор картинки $im
==================================== Большое спасибо за помощи с уважением Тэадор.
|