使用PHP输出为图像 [英] Output as an image using PHP
问题描述
我正在为"CMS"创建评论系统,并希望实现头像.我希望有一个"GETavatar.php",它使用GET请求为特定用户查找图像,同时还要进行一些图像处理.
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.
有人能指出我正确的方向,以便从php脚本中将数据输出为"image/png"吗?
Could anybody point me in the right direction for outputting data as "image/png" from a php script?
例如,以生成300x300的方式 http://placehold.it/300x300 网址中提供的参数中的png图片.
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.
推荐答案
To output an image using PHP: Output an Image in PHP
要使用PHP调整图像大小或编辑图像,请执行以下操作:在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.
这篇关于使用PHP输出为图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!