创建缩略图而不保存它们 [英] creating thumbnails without saving them
问题描述
我需要创建一个页面,如果选择了文件夹,它将自动从所有图像创建缩略图,并将它们显示在同一页面上.但问题是,我不想救他们.我想在不保存的情况下将它们显示在同一页面上.我需要在 PHP 中做到这一点.是否可以?请帮忙!注意:如果这不可能,我可以将它们放在某个文件夹中.
I need to create a page that will automatically create a thumbnail from all images if selected folder and show them on the same page. But the thing is, I don't want to save them. I want to display them on the same page without saving. And I need to do that in PHP. Is it possible? Please help! Note: If that is not possible,I can put them in some folder.
推荐答案
那么你必须制作第二个 PHP 文件.您必须在第一个文件 <img src='image.php'/>
中制作图像标记,并且在此 image.php 中您必须打印出图像,例如:
You have to make a second PHP-file then. You have to make an image tag in the first file <img src='image.php' />
and in this image.php you have to print out the image like:
header("Content-type: image/png");
$im = imagecreatefrompng("image.png");
list($width, $height) = getimagesize($im);
$newimage = imagecreatetruecolor($new_width, $new_height);
imagecopyresampled($newimage, $im, 0, 0, 0, 0, "100", "100", $width, $height);
imagepng($newimage);
imagedestroy($newimage);
imagedestroy($im);
这篇关于创建缩略图而不保存它们的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!