Smart Image Processor PHP 2 Support Product Page
This topic was archived
Not Resampling
Asked 11 Apr 2009 07:15:29
1
has this question
11 Apr 2009 07:15:29 Jon Spall posted:
I am using CS4 with Pure PHP Upload 2 and Smart Image Processor (which I had to upgrade to work with CS4 after buying the bargain package!) I can resize uploaded images fine, (800px & 80px for the thumb) but the quality is awful in all images larger than the thumbnail. It seems the large image is a physically larger version of the thumbnail image, but only using the pixels in the thumbnail. Obviously the large image is very pixelated. The only way I can get the larger picture to look any good is to resize my thumbnails to the same size as the main 800px image and forcing the webpage to display the 80px image.
My server tells me GD is installed - am I missing something obvious here?
Many thanks in advance
Replies
Replied 13 Apr 2009 16:24:06
13 Apr 2009 16:24:06 Miroslav Zografski replied:
Hi Jon,
Please, provide the code of the page in question. Also a link to one of the images you did resize to.
Regards,
Please, provide the code of the page in question. Also a link to one of the images you did resize to.
Regards,
Replied 23 Apr 2009 15:01:08
23 Apr 2009 15:01:08 Jon Spall replied:
Thankyou,
The Site is live - so I can not create a 80px thumb as the other images created by sipp become unuseable. However you can see the problem on the side using a 350px image.
My upload page creates 3 images:
large=800px, (www.framlingham.com/news/images/large_IMG_0029.JPG)
thumb=350 px (www.framlingham.com/news/images/thumb_IMG_0029.JPG)
normal=350px (www.framlingham.com/news/images/IMG_0029.JPG)
You will see that even now the 800px image is awful - imagine the 80px thumbnail!
Here is the code of my upload page: (I can not stop the silly emoticons showing?)
The Site is live - so I can not create a 80px thumb as the other images created by sipp become unuseable. However you can see the problem on the side using a 350px image.
My upload page creates 3 images:
large=800px, (www.framlingham.com/news/images/large_IMG_0029.JPG)
thumb=350 px (www.framlingham.com/news/images/thumb_IMG_0029.JPG)
normal=350px (www.framlingham.com/news/images/IMG_0029.JPG)
You will see that even now the 800px image is awful - imagine the 80px thumbnail!
Here is the code of my upload page: (I can not stop the silly emoticons showing?)
<?php
// Smart Image Processor PHP 2.0.5
if (isset($_GET['GP_upload'])) {
$sipp2 = new cGraphicMediator("upload", $ppu, "");
$sipp2->setComponent("Auto");
$sipp2->setMatteColor("#FFFFFF");
$sipp2->resize(350, 350, true);
$sipp2->overwrite = true;
$sipp2->saveJPEG(100);
$sipp2->process();
}
?>
<?php
// Smart Image Processor PHP 2.0.5
if (isset($_GET['GP_upload'])) {
$sipp1 = new cGraphicMediator("upload", $ppu, "");
$sipp1->setComponent("Auto");
$sipp1->setMatteColor("#FFFFFF");
$sipp1->resize(350, 350, true);
$sipp1->overwrite = false;
$sipp1->setMask("##path##thumb_##name##.jpg");
$sipp1->saveJPEG(100);
$sipp1->process();
}
?>
<?php
// Smart Image Processor PHP 2.0.5
if (isset($_GET['GP_upload'])) {
$sipp3 = new cGraphicMediator("upload", $ppu, "");
$sipp3->setComponent("Auto");
$sipp3->setMatteColor("#FFFFFF");
$sipp3->resize(800, 800, true);
$sipp3->overwrite = false;
$sipp3->setMask("##path##large_##name##.jpg");
$sipp3->saveJPEG(100);
$sipp3->process();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/jons_CMS_template.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Untitled Document</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<style type="text/css">
<!--
/* BEGIN Advanced HTML Editor */
.dmx_btn { width: 22px; height: 22px; border: 1px solid #F8F4DD; margin: 0; padding: 0; background-color: #F8F4DD; }
.dmx_btnOver { width: 22px; height: 22px; border: 1px outset #EDE3A8; margin: 0; padding: 0; background-color: #EDE3A8; }
.dmx_btnDown { width: 22px; height: 22px; border: 1px inset #EDE3A8; margin: 0; padding: 0; background-color: #EDE3A8; }
.dmx_btnNA { width: 22px; height: 22px; border: 1px solid #F8F4DD; margin: 0; padding: 0; background-color: #F8F4DD; -moz-opacity:0.25; opacity:0.25; filter: alpha(opacity=25); }
.dmx_menuBar { height: 30px; background-color: #F8F4DD; }
/* END Advanced HTML Editor */
-->
</style>
<script language="javascript">
<!--
/* BEGIN Advanced HTML Editor */
var BaseURL = "../";
/* END Advanced HTML Editor */
//-->
</script>
<script language="JavaScript" src="../ScriptLibrary/AdvHTMLLang.js"></script>
<script language="JavaScript" src="../ScriptLibrary/AdvHTMLEdit.js"></script>
<!-- InstanceEndEditable -->
<link href="../framCMSLayout.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
body {
background-color: #CCC;
}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #000;
}
a:hover {
text-decoration: underline;
}
a:active {
text-decoration: none;
}
-->
</style></head>
<body>
<div id="cms_holder">
<div id="cms_header">[img]../tc_images/top_banner.jpg" width="950" height="152" /></div>
<div id="cms_menu">| <a href="cms_logout.php">Logout</a> | <a href="cms_news.php">News</a> | <a href="cms_events.php">Annual Events</a> | <a href="cms_reg_events.php">Weekly Events</a> | <a href="cms_bulletin.php">Notice Board</a> | <a href="cms_docs.php">Documents</a> | Image Gallery |</div>
<div id="under_menu"></div>
<!-- InstanceBeginEditable name="cms_body" -->
<script language='JavaScript' src='../ScriptLibrary/incPureUpload.js' type="text/javascript"></script>
<div id="cms_body">
<p> </p>
<p class="largeText">Framlingham News</p>
<p> </p>
<form action="<?php echo $editFormAction; ?>" method="post" enctype="multipart/form-data" name="form1" id="form1" onsubmit="checkFileUpload(this,'',true,'','','','','','','');showProgressWindow('blueFlashProgress.htm',300,100);return document.MM_returnValue">Edited by - Jon Spall on 23 Apr 2009 15:03:06
Replied 28 Apr 2009 14:16:18
28 Apr 2009 14:16:18 Miroslav Zografski replied:
Hi Jon,
Because in php the code is executed from beginning of the page to the end the way you have those SIPs added on the page first one resizes the file to 350px then next one and finaly the third one is setting it to 800px so you have that loss in quality. You need to reverse the order of the SIPs by reapplying them or by cut/paste the code in code view.
Regards,
Because in php the code is executed from beginning of the page to the end the way you have those SIPs added on the page first one resizes the file to 350px then next one and finaly the third one is setting it to 800px so you have that loss in quality. You need to reverse the order of the SIPs by reapplying them or by cut/paste the code in code view.
Regards,
Replied 17 May 2009 12:57:17
17 May 2009 12:57:17 Mat p replied:
Do you need to have a new sipp for each image field. I have 10 image fields in my form, but when i try to upload and turn to thumbs it does not work.
How do i get the thumbs to display to the recordset??
How do i get the thumbs to display to the recordset??
<?php require_once('../Connections/tre.php'); ?>
<?php require_once('../ScriptLibrary/incPureUpload.php'); ?>
<?php require_once('../ScriptLibrary/cGraphicMediator.php'); ?>
<?php
// Pure PHP Upload 2.1.8
$ppu = new pureFileUpload();
$ppu->path = "../properties";
$ppu->extensions = "JPG,JPEG";
$ppu->formName = "form1";
$ppu->storeType = "file";
$ppu->sizeLimit = "";
$ppu->nameConflict = "uniq";
$ppu->requireUpload = "false";
$ppu->minWidth = "";
$ppu->minHeight = "";
$ppu->maxWidth = "";
$ppu->maxHeight = "";
$ppu->saveWidth = "";
$ppu->saveHeight = "";
$ppu->timeout = "600";
$ppu->progressBar = "showProgress.htm";
$ppu->progressWidth = "300";
$ppu->progressHeight = "100";
$ppu->redirectURL = "";
$ppu->checkVersion("2.1.8");
$ppu->doUpload();
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
if (isset($editFormAction)) {
if (isset($_SERVER['QUERY_STRING'])) {
if (!eregi("GP_upload=true", $_SERVER['QUERY_STRING'])) {
$editFormAction .= "&GP_upload=true";
}
} else {
$editFormAction .= "?GP_upload=true";
}
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO tre (ID, title, price, `desc`, bed, bath, car, photo1, photo2, photo3, photo4, photo5, photo6, photo7, photo8, photo9, photo10) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['ID'], "int"),
GetSQLValueString($_POST['title'], "text"),
GetSQLValueString($_POST['price'], "text"),
GetSQLValueString($_POST['desc'], "text"),
GetSQLValueString($_POST['bed'], "text"),
GetSQLValueString($_POST['bath'], "text"),
GetSQLValueString($_POST['car'], "text"),
GetSQLValueString($_POST['photo1'], "text"),
GetSQLValueString($_POST['photo2'], "text"),
GetSQLValueString($_POST['photo3'], "text"),
GetSQLValueString($_POST['photo4'], "text"),
GetSQLValueString($_POST['photo5'], "text"),
GetSQLValueString($_POST['photo6'], "text"),
GetSQLValueString($_POST['photo7'], "text"),
GetSQLValueString($_POST['photo8'], "text"),
GetSQLValueString($_POST['photo9'], "text"),
GetSQLValueString($_POST['photo10'], "text"));
mysql_select_db($database_tre, $tre);
$Result1 = mysql_query($insertSQL, $tre) or die(mysql_error());
$insertGoTo = "add.php?d=1";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
?>
<?php
// Smart Image Processor PHP 2.0.5
if (isset($_GET['GP_upload'])) {
$sipp2 = new cGraphicMediator("upload", $ppu, "");
$sipp2->setComponent("Auto");
$sipp2->setMatteColor("#FFFFFF");
$sipp2->resize(117, 117, true);
$sipp2->overwrite = false;
$sipp2->setMask("##path##thumb_##name##.jpg");
$sipp2->saveJPEG(80);
$sipp2->process();
}
?> Replied 20 May 2009 09:15:16
20 May 2009 09:15:16 Miroslav Zografski replied:
Hello Mat,
If you need to create only a thumb for the original image then you need only one instance of SIP. If you what to resample the original as well then you need two instances.
Regards,
If you need to create only a thumb for the original image then you need only one instance of SIP. If you what to resample the original as well then you need two instances.
Regards,
