php - How to draw an 8x8 square on an image? -
I have an image: image.png (can be jpg or gif)
How do I I can attract an 8x8 square on $ x, $ y
and then on the image to $ file
You are searching:
// load the image $ img = imagecreatefrompng (" image.png "); // or imagecreatefromjpeg (), etc. // $ Colors = Set a color for the side of the image colourallocate ($ img, 255, 255, 255); // Make a 8x8 recurrence on coordinates ($ x, $ y) for a white rectangle / top left picture ($ IMG, $ x, $ y, $ x + 8, $ y + 8, $ color); // Or, if you want to fill it, then use imagefilledrectangle () with the same logic // Save image image image ($ img, "image.png"); // or imagejpeg (), etc.
Comments
Post a Comment