[英]How to save/copy Facebook image URL to my SERVER as an image?
[英]How do I rotate an image on my server then save it back to to its initial url?
我的目标是能够从我的服务器上的网址中提取图像,将该图像旋转90度,然后将其保存回我从中拉出的相同网址。
我尝试了很多不同的方法,但没有任何工作。
这就是我目前所拥有的:
$imurl = "../images/sample.jpg";
$file = fopen($imurl, "rb");
$rotim = imagerotate($file, 90, 0);
move_uploaded_file($rotim, $imurl);
我不确定这是否会改变,但图片网址与当前文件不在同一目录中。
我一直在这两种链接格式之间交替 - 似乎都不起作用。
$imurl = "https://www.site.com/images/1/picture.jpg"
$imurl = "../images/1/picture"
你的90%那里..
$imurl = "../images/sample.jpg";
$file = imagecreatefromjpeg($imurl); //http://nz2.php.net/manual/en/function.imagecreatefromjpeg.php
$rotim = imagerotate($file, 90, 0); //http://nz2.php.net/manual/en/function.imagerotate.php
imagejpeg($rotim, $imurl); //http://nz2.php.net/manual/en/function.imagejpeg.php
小心相对路径,我更喜欢尽可能使用完整路径。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.