创建缩略图而不保存它们 [英] creating thumbnails without saving them

查看:32
本文介绍了创建缩略图而不保存它们的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建一个页面,如果选择了文件夹,它将自动从所有图像创建缩略图,并将它们显示在同一页面上.但问题是,我不想救他们.我想在不保存的情况下将它们显示在同一页面上.我需要在 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆