我在 NAS 上有一個包含多個圖像的文件夾。我想在文件夾中制作圖像的本地副本,顯示圖像然后刪除它們,這樣它們就不會接管服務器上的本地。查看照片后如何刪除照片?我制作了這段代碼,但它刪除了以下圖像,因此無法顯示:<?php$file = '//Alcyons/it/PhotoShoot/Photos_Outil/A1111_0070_1.jpg';$newfile = 'A1111_0070_1.jpg';if (!copy($file, $newfile)) { echo "La copie $file du fichier a échoué...\n";}echo "</td><td valign=top align=center><img src=\"$newfile\" border=0 width=180px></a></td><td width=10></td>";unlink($newfile);?>
1 回答

繁花不似錦
TA貢獻1851條經驗 獲得超4個贊
復制文件能解決什么問題?
如果立即刪除它有什么意義?
根據您的代碼結構,那個會更好:
<?php
$file = '//Alcyons/it/PhotoShoot/Photos_Outil/A1111_0070_1.jpg';
$type = pathinfo($file, PATHINFO_EXTENSION);
?>
</td>
<td valign=top align=center>
<img src="<?php echo "data:image/$type;base64,",
base64_encode(file_get_contents($file)) ?>" border=0 width="180"></a>
</td>
<td width=10></td>
- 1 回答
- 0 關注
- 97 瀏覽
添加回答
舉報
0/150
提交
取消