PHP-如何将图像资源写入文件 [英] PHP - How to write image resource to file
本文介绍了PHP-如何将图像资源写入文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用功能 imagecopyresampled
裁剪图像.
我尝试使用 file_put_contents
和fwrite将resized_image写入硬盘上的文件,但是所有尝试均失败.
I tried use file_put_contents
and fwrite to write the resized_image to file on hard disk but all attempts were failed.
是否可以将调整大小后的图像写到磁盘上,而不是使用 imagejpg
将其打印到浏览器中?
Can I write the resized image to disk instead of using imagejpg
to print it out to browser?
推荐答案
这是因此,提供目标文件名作为第二个参数.(适用标准文件系统权限警告,请确保该进程具有对该目录的写访问权.)
So, provide your destination filename as the second argument. (Standard filesystem permission warnings apply, make sure the process has write access to that directory.)
这篇关于PHP-如何将图像资源写入文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文