开发者

PHP, GD, Image Manipulation

开发者 https://www.devze.com 2023-02-15 03:49 出处:网络
Image Thumbnails and Etc. Connection to database for the filename and details The table contains all the real file information.Mimetype, extensions and etc.

Image Thumbnails and Etc.

Connection to database for the filename and details The table contains all the real file information. Mimetype, extensions and etc.

The physical images are located on a hdd in a folder path and are renamed as follow:开发者_如何学C s:\onlinemedia\files\1\2241.dat

[Type pjpeg] [Mime image/jpeg]

I can get all of that information however, when I set header to image/jpg I get the output of my string to the path.

s:\onlinemedia\files\1\2241.dat

$fileid = $passcode = '';
$fileid     = (isset($_GET['fileid']) ? $_GET['fileid'] : '');
$passcode   = (isset($_GET['passcode']) ? $_GET['passcode'] :'');
$filename = $frw->source->img($fileid,$passcode);
$thumb = PhpThumbFactory::create($filename);
$thumb->adaptiveResize(16,16);
$thumb->save($filename);
$thumb->show($filename);

What is really happening here?


One thing I see in the posted code is this:

$thumb = PhpThumbFactory::create($filename);
$thumb->adaptiveResize(16,16);
$thumb->save($filename);
$thumb->show($filename);

When doing $thumb-save(); you need to pass the path to a new file to save it as. How you have it now will overwrite the original if you actually want to do that. Also, $thumb->show(); shouldn't need a parameter, it goes off the path parameter you used to create the object to begin with. I'm also not sure if you need to mess with the headers using PhpThumbFactory, as the show() method handles that I think.

0

精彩评论

暂无评论...
验证码 换一张
取 消