%preserve_order%>
<%include:header%>
$featured = "<%link_pick%>"; ?>
if ($id != '16618') { ?>
} ?>
<%include:product_header%>
>
|
require_once('phpthumb/phpthumb.class.php');
$screenshoturl = "<%link_cust6%>";
$phpThumb->setSourceFileName($screenshoturl);
// create 3 sizes of thumbnail
$thumbnail_widths = array(160, 320, 640);
$capture_raw_data = false; // set to true to insert to database rather than render to screen or file (see below)
foreach ($thumbnail_widths as $thumbnail_width) {
// Note: If you want to loop through and create multiple
// thumbnails from different image sources, you should
// create and dispose an instance of phpThumb() each time
// through the loop and not reuse the object.
$phpThumb = new phpThumb();
// set data
$phpThumb->setSourceFilename($_FILES['userfile']['tmp_name']);
// or $phpThumb->setSourceData($binary_image_data);
// or $phpThumb->setSourceImageResource($gd_image_resource);
// set parameters (see "URL Parameters" in phpthumb.readme.txt)
$phpThumb->setParameter('w', $thumbnail_width);
//$phpThumb->setParameter('h', 100);
//$phpThumb->setParameter('fltr', 'gam|1.2');
// set options (see phpThumb.config.php)
// here you must preface each option with "config_"
$phpThumb->setParameter('config_output_format', 'jpeg');
$phpThumb->setParameter('config_imagemagick_path', '/usr/local/bin/convert');
//$phpThumb->setParameter('config_allow_src_above_docroot', true); // needed if you're working outside DOCUMENT_ROOT, in a temp dir for example
// generate & output thumbnail
$output_filename = './thumbnails/'.basename($_FILES['userfile']['name']).'_'.$thumbnail_width.'.'.$phpThumb->config_output_format;
if ($phpThumb->GenerateThumbnail()) { // this line is VERY important, do not remove it!
$output_size_x = ImageSX($phpThumb->gdimg_output);
$output_size_y = ImageSY($phpThumb->gdimg_output);
if ($output_filename || $capture_raw_data) {
if ($capture_raw_data && $phpThumb->RenderOutput()) {
// RenderOutput renders the thumbnail data to $phpThumb->outputImageData, not to a file or the browser
mysql_query("INSERT INTO `table` (`thumbnail`) VALUES ('".mysql_escape_string($phpThumb->outputImageData)."') WHERE (`id` = '".$id."')");
} elseif ($phpThumb->RenderToFile($output_filename)) {
// do something on success
echo 'Successfully rendered:
';
} else {
// do something with debug/error messages
echo 'Failed (size='.$thumbnail_width.'):'.implode("\n\n", $phpThumb->debugmessages).'';
}
} else {
$phpThumb->OutputThumbnail();
}
} else {
// do something with debug/error messages
echo 'Failed (size='.$thumbnail_width.'). ';
echo ''.$phpThumb->fatalerror.' ';
echo ' ';
}
// remember to unset the object each time through the loop
unset($phpThumb);
}
?>
<%include:footer%> |