[ Team LiB ] Previous Section Next Section

Workshop

Quiz

1:

Which header should you send to the browser before building and outputting a PNG image?

2:

Which function could you use to acquire an image resource that you can use with other image functions?

3:

Which function would you use to output your PNG after building it?

4:

Which function could you use to acquire a color resource?

5:

With which function would you draw a line on a dynamic image?

6:

Which function would you use to fill an area in a dynamic image?

7:

Which function might you use to draw an arc?

8:

How might you draw a rectangle?

9:

How would you draw a polygon?

10:

Which function would you use to write a string to a dynamic image?


Answers

A1:

To output a PNG image, you should use the header() function to send the line "Content-type: image/png" to the browser.

A2:

The imagecreate() function, returns an image resource. Functions such as imagecreatefrompng() can also be used to acquire an image resource from a file on the server.

A3:

You can output a PNG file with the imagepng() function.

A4:

You can acquire a color resource with the imagecolorallocate() function.

A5:

The imageline() function draws a line.

A6:

The imagefill() function fills an area with color.

A7:

You can draw an arc with the imagearc() function.

A8:

You can draw an outline rectangle with the imagerectangle() function. If you want to draw a filled rectangle, you can use imagefilledrectangle().

A9:

You can draw a polygon with either imagepolygon() or imagefilledpolygon().

A10:

You can write a string to a dynamic image with the imageTTFtext() function. You could also use the imagestring() function if you needed less control over positioning, size, and font.


    [ Team LiB ] Previous Section Next Section