Jump to content

Recommended Posts

This is so hard. :/

 

I have the following code:

 

<?php
$signature = @imagecreate(350,60);
$image_generate = imagecolorallocate($signature,84, 84, 84);
$red = imagecolorallocate($signature,255,36,0);

imagefilledrectangle($signature, 0, 1, 150, 30, $red);

header("Content-type:image/png");
imagepng($signature);


?>

 

How can I get the rectangle in the center?

 

http://zchighscores.99k.org/image.php

 

I don't really know what to change to get it in the right coordinates. :/

Sorry, my bad, I misread one of your numbers.  Change it to this:

 

imagefilledrectangle($signature, 100, 15, 250, 30, $red);

 

It's really simple, the numbers are just offsets from the top left of the image.

 

In your main image 0,0,350,60 means:

The top left point should be placed 0 pixels from the left of the screen and 0 pixels from the top of the screen.

 

In your main image 0,0,350,60 means:

The bottom right point should be placed 350 pixels from the left of the screen and 60 pixels from the top of the screen.

 

Exactly the same applies for the filled rectangle, but it's numbers are offset against the parent image.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.