Hi Guys,
I need some help, and somewhat newbie in php but i get along usually.
I have a special field for image classes, so i want to resize them with http://www.site.com/show_imagex.php?file=%field% this works in my code but i have lots of images, around 20+ per page, so i think it takes a hit on the server. So i was thinking to save them and display them, something like this:
<?php
require_once 'ThumbLib.inc.php';
$fileName = (isset($_GET['file'])) ? urldecode($_GET['file']) : null;
if ($fileName === null || !file_exists($fileName))
{
echo "<p>imagine lipsa</p>";
}
try
{
$thumb = PhpThumbFactory::create($fileName);
}
catch (Exception $e)
{
echo "<p>exception</p>";
}
if(!file_exists('static/'.$fileName))
{
$thumb->adaptiveResize(170, 80);
$thumb->save('static/'.$fileName);
}
$new = PhpThumbFactory::create('static/'.$fileName);
if(file_exists('static/'.$fileName))
{
$new->show();
}
?>
So basically get the field name, save in static, and show it. Now i dont know if this uses resources each time i call it, to create a new thumb, or it takes it from static.
Any suggestions?