• Sorular
  • Etiketler

Bir görüntü üzerinde 8x8 kare çizmek nasıl?

1 Cevap

Ben bir görüntü var: image.png (jpg veya gif olabilir)

Nasıl $x, $y bir 8x8 kare çizmek ve daha sonra görüntü kaydetmek $file?

1 Cevap

Aradığınız imagerectangle() :

// Load the image
$img = imagecreatefrompng("image.png"); // or imagecreatefromjpeg(), etc.

// Set a colour for the sides of the rectangle
$color = imagecolorallocate($img, 255, 255, 255); // for a white rectangle

// Draw an 8x8 recangle at coordinates ($x, $y) from top left
imagerectangle($img, $x, $y, $x+8, $y+8, $color);

// Or, use imagefilledrectangle() with the same arguments if you want it filled

// Save the image
imagepng($img, "image.png"); // or imagejpeg(), etc.
0

etiketler

  • Sorular
  • Etiketler
Copyright © 2014

Powered by EvrenWeb Int. Media.