简体   繁体   English

使用php在Linux中读取图像文件

[英]reading an image file in linux using php

I have created an image file like this 我已经创建了这样的图像文件

$imageData = file_get_contents($_POST['imgs1']);
chmod('/var/www/r1/assets/admin/pages/chart/image2.png',0644);
file_put_contents('/var/www/r1/assets/admin/pages/chart/image2.png',$imageData);

Now the problem is file is created with lock symbol. 现在的问题是使用锁定符号创建了文件。 How can I remove this lock symbol from file using php? 如何使用php从文件中删除此锁定符号?

The lock symbol in Linux is because you don t have write permission to the file. in this case,file permission is 644 and the owner is user apache.then you don Linux中的锁定符号是因为您t have write permission to the file. in this case,file permission is 644 and the owner is user apache.then you don t have write permission to the file. in this case,file permission is 644 and the owner is user apache.then you don t have write permission. t have write permission to the file. in this case,file permission is 644 and the owner is user apache.then you don就没有写许可权。

For removing the lock icon, change the permission to 755 or change the owner of the file to your user (I recommend changing chmod ). 要删除锁定图标,请将权限更改为755或将文件所有者更改为您的用户(我建议更改chmod )。

chmod('/var/www/r1/assets/admin/pages/chart/image2.png',0755);

Lock symbol means you don't have permission on that image.To remove lock symbol you have to give right permission 777 锁定符号表示您对该图像没有权限。要删除锁定符号,您必须授予权限777

use 采用

exec("chmod -R 777 /var/www/r1/assets/admin/pages/chart/image2.png"); 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM