Php Gravatar返回错误的文件扩展名
我试图通过在散列的末尾添加.JPG来从Gravatar获取JPG图像,如下所示: 但是,如果我像这样将其保存到磁盘:Php Gravatar返回错误的文件扩展名,php,gravatar,Php,Gravatar,我试图通过在散列的末尾添加.JPG来从Gravatar获取JPG图像,如下所示: 但是,如果我像这样将其保存到磁盘: file_put_contents($path, file_get_contents('https://www.gravatar.com/avatar/00000000000000000000000000000000.jpg?d=wavatar&f=y')); 或者,如果我把它直接从浏览器保存到我的计算机上,我会注意到这个文件实际上是一个PNG图像 为什么会这样? 我
file_put_contents($path, file_get_contents('https://www.gravatar.com/avatar/00000000000000000000000000000000.jpg?d=wavatar&f=y'));
或者,如果我把它直接从浏览器保存到我的计算机上,我会注意到这个文件实际上是一个PNG图像
为什么会这样?我错过什么了吗
太棒了 该链接将为您提供png文件,即使最后有jpg。如果您想要jpeg图像,请在php中尝试
echo '<img src="https://www.gravatar.com/avatar/'. md5(strtolower("myemail@gmail.com")).'"
class="img-circle" alt="User Image">';
echo';
请点击并下载代码。Oh。。。好的,这就是API给出的全部内容。那么,为什么不使用gd将其转换为JPG呢?