A
Anonymous
Guest
Hi,
I have this php script:
cfgConvert is meant to use imagemajick.
Instead, all I want the above script to do is display the thumb from the main image resized, or create one a thumb without using imagemagick.
Can anyone help?
Thanks in advance.
Simon
I have this php script:
Code:
<?
function getThumbTag($iid, $type, $sql) {
global $cfgImageDirLocal, $cfgImageDirWeb;
global $cfgThumbDirLocal, $cfgThumbDirWeb;
global $cfgThumbWidth, $cfgThumbHeight;
global $cfgMediumWidth, $cfgMediumHeight;
global $cfgConvert;
if ($type == "medium") {
$makeThumb = 0;
$thumbName = "$iid-m.jpg";
} else {
$makeThumb = 1;
$thumbName = "$iid.jpg";
}
// If thumbnail does not exists - create it!
if (!file_exists($cfgThumbDirLocal . $thumbName)) {
// create thumbnail
// Get image info
$query = "SELECT ID, sFile from tblImage WHERE ID = $iid";
$result = mysql_query($query, $sql);
if ($result && $row=mysql_fetch_array($result))
{
$sql_ID = $row["ID"];
$sql_sFile = $row["sFile"];
} else {
die(mysql_error() . ": " . $query);
}
// Create thumbnail
$fromFile = $cfgImageDirLocal . $sql_sFile . "[0]";
if ($makeThumb) { // thumb
$geometry = $cfgThumbWidth."x".$cfgThumbHeight.">";
} else { // medium
$geometry = $cfgMediumWidth."x".$cfgMediumHeight.">";
}
$ext = strrchr($sql_sFile,'.');
if (strcasecmp($ext, ".pdf") == 0) {
$sExtraOption = "-flatten ";
} else {
$sExtraOption = "";
}
exec("$cfgConvert -geometry '$geometry' " . $sExtraOption . escapeshellarg($fromFile) . " " . $cfgThumbDirLocal . $thumbName);
}
return "<img src=\"" . $cfgThumbDirWeb . $thumbName . "\" border=\"0\">";
}
?>
cfgConvert is meant to use imagemajick.
Instead, all I want the above script to do is display the thumb from the main image resized, or create one a thumb without using imagemagick.
Can anyone help?
Thanks in advance.
Simon