Теперь по-русски...
Очень медленная операция! Почему?
Я попробовал загрузить изображение непосредственно через браузер так http://myserver.com/images/button1.png и оно грузится моментально. А с использованием скрипта то же изображение загружается НЕПРИЕМЛИМО МЕДЛЕННО!
В чем причина?
Example #1 PNG creation with PHP
<?php
header("Content-type: image/png");
$string = $_GET['text'];
$im = imagecreatefrompng("images/button1.png");
$orange = imagecolorallocate($im, 220, 210, 60);
$px = (imagesx($im) - 7.5 * strlen($string)) / 2;
imagestring($im, 3, $px, 9, $string, $orange);
imagepng($im);
imagedestroy($im);
?>
This example would be called from a page with a tag like: <img src="button.php?text=text">. The above button.php script then takes this "text" string and overlays it on top of a base image which in this case is "images/button1.png" and outputs the resulting image. This is a very convenient way to avoid having to draw new button images every time you want to change the text of a button. With this method they are dynamically generated.
PNG creation with PHP
alexgradov at rambler dot ru
01-Jun-2009 04:03
01-Jun-2009 04:03
alexgradov at rambler dot ru
01-Jun-2009 03:55
01-Jun-2009 03:55
Very slowly operation! Why???
I tried to load image from site direct and it's load VERY FAST! But this example is TOO SLOWLY!
