battles/mg.php

22 lines
1015 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// Создаем первую картинку на основе готового изображения
$im1=imageCreateFromGIF("i/sh/".$_GET['i']);
$colorcount = imagecolorstotal($im1);
// Определяем ее размеры
$size_x=imageSX($im1);
$size_y=imageSY($im1);
// Создаем вторую пустую картинку
$im2=imageCreate($size_x,$size_y);
imagetruecolortopalette($im2,true,$colorcount);
imagepalettecopy($im2,$im1);
$transparentcolor = imagecolortransparent($im1);
imagefill($im2,0,0,$transparentcolor);
imagecolortransparent($im2,$transparentcolor);
// Копируем рисунок целиком из первого изображения во второе
//imageCopy($im2,$im1,0,0,0,0,$size_x,$size_y-$size_y*$_GET['p']/100);
imageCopy($im2,$im1,0,$size_y-$size_y*$_GET['p']/100,0,$size_y-$size_y*$_GET['p']/100,$size_x,$size_y);
// Сохранение скопированной картинки в файле
Header("Content-type: image/gif");
imageGIF($im2);
?>