winbackgo
@winbackgo

Как сгенерировать GIF заданного размера из строки?

Имеется функция которая генерирует 1x1 px gif. Надо изменить ее так чтобы можно было задавать размер. Не могу понять из спецификации, где указывать размеры.
function gifStr($r = 0, $g = 0, $b = 0, $transparent = true) 
{
	return pack('C*',
		71, 73, 70, 56, 57, 97, // "GIF89a"

		// Logical screen descriptor
		1, 0, // logical screen width
		1, 0, // logical screen height
		128, // global color table | color resolution(3) | sort flag | size of global color table (3)
		0, // background color index
		0, // pixel aspect ratio
		$r, $g, $b, 0, 0, 0, // global color table

		// Graphic control extension
		0x21, // extension introducer
		0xF9, // graphic control label
		4, // block size
		1, // disposal method(3) | user input(3) | transparency |
		0, 0, // delay time
		$transparent ? 0 : 1, // transparent color index
		0, // block terminator

		// Image descriptor
		0x2C, // image seperator
		0, 0, // image left position
		0, 0, // image top position
		1, 0, // image height
		1, 0, // image width
		0, // local color | interlaced | ordered | reserved(2) | size of color table (3)

		2, 2, 68, 1, 0, // image data

		59); // gif trailer
}

А надо
function gifStr($width = 1, $height = 1, $r = 0, $g = 0, $b = 0, $transparent = true)  {...}

Есть задача генерировать 1000 гифок на лету, 1 пиксельная гифка генерируется в ~1000 раз быстрее чем imagecreate > imagegif (0.00292 sec. против 1.75561 sec. imagegif для тысячи гифок)
  • Вопрос задан
  • 2248 просмотров
Пригласить эксперта
Ответы на вопрос 1
ilyaplot
@ilyaplot
PHP программист
1, 0, // logical screen width
1, 0, // logical screen height
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы
29 мар. 2024, в 10:00
10000 руб./за проект
29 мар. 2024, в 09:59
750 руб./в час
29 мар. 2024, в 09:55
50000 руб./за проект