Image Generator

Asked

Viewed 92 times

-1

Does anyone know how to create a PHP code to generate an image that you pass through the url image.php?src=logo&width=600&height=600 and the end result is an image with the specific dimensions and go to imgs/logo.png.

PS: The format has to be .png.

  • I didn’t get the negative!

  • 3

    The negative is for the type of question. Yes, a lot of people know how to create this code, but the ideal is that you try to write it first and if you find any difficulty in this activity, come back here with a specific problem to be solved.

1 answer

1

You need to take the parameters by get and assign the HTML img tag.

For example. If your page is this "image.php? src=logo&width=600&height=600" the code will be:

<img src="imgs/<?php echo $_GET['src'] ?>.png" width="<?php echo $_GET['width'] ?>" height="<?php echo $_GET['height'] ?>">

Browser other questions tagged

You are not signed in. Login or sign up in order to post.