问题
I'm creating a comments system for my 'CMS' and would like to implement avatars. I would like to have a "getavatar.php" that uses a GET request to find an image for a certain user, while also doing some image processing.
Could anybody point me in the right direction for outputting data as "image/png" from a php script?
An example of this would be http://placehold.it/300x300 in the way it generates a 300x300 png image from the parameters given in the URL.
回答1:
To output an image using PHP: Output an Image in PHP
To resize or edit an image using PHP: resize image in PHP
Both answers contains a lot of useful functions. Hope this help you.
来源:https://stackoverflow.com/questions/26829208/output-as-an-image-using-php