Smart Image Processor PHP 2 Support Product Page
This topic is locked
This topic was archived
SIP PHP 2 Not Resizing Image
Asked 09 Jun 2009 00:44:10
1
has this question
09 Jun 2009 00:44:10 Heather V posted:
I recently purchased SIP PHP 2 (today) and the image is not resizing. I'm using DW8, PHP5, WVista; I'm using Insert Record Server Behavior and Sessions within the code. I hope someone will be able to assist me with this product. From what I've heard, it does wonderful things, if only I can get it to work.
I'm currently on a local host that has GD enabled (PHP 5).
Quirky thing: I tested PHP Upload 2 and SIP PHP 2 on just a plain .php file (no other server behavior or dbase queries) and the product(s) worked like a charm. I'm suspecting the problem has something to do with the way the code is organized within my file that has the server behaviors.
File will upload, but not resized. I would like to know how to solve the problem.
If it helps, this is what the code looks like:
... <?php require_once('../../Connections/****.php'); ?> <?php //initialize the session if (!isset($_SESSION)) { session_start(); } // ** Logout the current user. ** $logoutAction = $_SERVER['PHP_SELF']."?doLogout=true"; if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){ $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){ //to fully log out a visitor we need to clear the session varialbles $_SESSION['MM_Username'] = NULL; $_SESSION['MM_UserGroup'] = NULL; $_SESSION['PrevUrl'] = NULL; unset($_SESSION['MM_Username']); unset($_SESSION['MM_UserGroup']); unset($_SESSION['PrevUrl']); $logoutGoTo = "../../index.php"; if ($logoutGoTo) { header("Location: $logoutGoTo"); exit; } } ?> <?php if (!isset($_SESSION)) { session_start(); } $MM_authorizedUsers = "y"; $MM_donotCheckaccess = "false"; // *** Restrict Access To Page: Grant or deny access to this page function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { // For security, start by assuming the visitor is NOT authorized. $isValid = False; // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. // Therefore, we know that a user is NOT logged in if that Session variable is blank. if (!empty($UserName)) { // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. // Parse the strings into arrays. $arrUsers = Explode(",", $strUsers); $arrGroups = Explode(",", $strGroups); if (in_array($UserName, $arrUsers)) { $isValid = true; } // Or, you may restrict access to only certain users based on their username. if (in_array($UserGroup, $arrGroups)) { $isValid = true; } if (($strUsers == "") && false) { $isValid = true; } } return $isValid; } $MM_restrictGoTo = "../index.php"; if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) { $MM_qsChar = "?"; $MM_referrer = $_SERVER['PHP_SELF']; if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&"; if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0) $MM_referrer .= "?" . $QUERY_STRING; $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer); header("Location: ". $MM_restrictGoTo); exit; } ?> <?php require_once('../../ScriptLibrary/incPureUpload.php'); ?> <?php require_once('../../ScriptLibrary/cGraphicMediator.php'); ?> <?phphttp://www.dmxzone.com/images/forum/smilies/icon_smile.gif // Pure PHP Upload 2.1.8 $ppu = new pureFileUpload(); $ppu->path = "../../photos/staff"; $ppu->extensions = "GIF,JPG,JPEG,BMP,PNG"; $ppu->formName = "form1"; $ppu->storeType = "file"; $ppu->sizeLimit = "100"; $ppu->nameConflict = "over"; $ppu->requireUpload = "false"; $ppu->minWidth = ""; $ppu->minHeight = ""; $ppu->maxWidth = ""; $ppu->maxHeight = ""; $ppu->saveWidth = ""; $ppu->saveHeight = ""; $ppu->timeout = "600"; $ppu->progressBar = ""; $ppu->progressWidth = ""; $ppu->progressHeight = ""; $ppu->redirectURL = ""; $ppu->checkVersion("2.1.8"); $ppu->doUpload(); 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 (!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; } } $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, "staff_photo"); $sipp2->setComponent("Auto"); $sipp2->setMatteColor("#FFFFFF"); $sipp2->resize(150, 165, true); $sipp2->overwrite = true; $sipp2->saveJPEG(100); $sipp2->process(); } ?> <?php if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO staff (staff_name, staff_position, staff_as_coach, staff_subposition, staff_desc, staff_photo, staff_spec_1, staff_spec_2, staff_spec_3, staff_spec_4, staff_spec_5) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['staff_name'], "text"), GetSQLValueString($_POST['staff_position'], "text"), GetSQLValueString($_POST['staff_as_coach'], "text"), GetSQLValueString($_POST['staff_subposition'], "text"), GetSQLValueString($_POST['staff_desc'], "text"), GetSQLValueString($_POST['staff_photo'], "text"), GetSQLValueString($_POST['staff_spec_1'], "text"), GetSQLValueString($_POST['staff_spec_2'], "text"), GetSQLValueString($_POST['staff_spec_3'], "text"), GetSQLValueString($_POST['staff_spec_4'], "text"), GetSQLValueString($_POST['staff_spec_5'], "text")); mysql_select_db($database_****admin, $****admin); $Result1 = mysql_query($insertSQL, $****admin) or die(mysql_error()); $insertGoTo = "****.php"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; header(sprintf("Location: %s", $insertGoTo)); } // if the record has been inserted, clear the POST array $_POST = array(); } ?> <!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"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script language='javascript' src='../../ScriptLibrary/incPureUpload.js'></script> </head> <body> <form action="<?php echo $editFormAction; ?>" method="post" enctype="multipart/form-data" name="form1" onsubmit="checkFileUpload(this,'GIF,JPG,JPEG,BMP,PNG',false,100,'','','','','','');return document.MM_returnValue"> <table width="80%" align="center" cellspacing="0" border="0"> <tr valign="baseline"> <td nowrap align="right">Upload Photo: </td> <td colspan="2"><input name="staff_photo" type="file" id="staff_photo" onchange="checkOneFileUpload(this,'GIF,JPG,JPEG,BMP,PNG',false,100,'','','','','','')" /> <br /> <span class="small">Image dimensions maximum is 150px (w) x 165px (h) and less than 30k</span> </td> </tr> <tr valign="baseline"> <td nowrap align="right">Name:</td> ...other stuff not necessary to post <td colspan="2"><input name="insert" type="submit" id="insert" value="Insert record"></td> </tr> </table> <input type="hidden" name="MM_insert" value="form1"> <input name="staff_photo" type="hidden" id="staff_photo" /> </form> other stuff not necessary to post</body> </html>
Edited by - heather heather on 09 Jun 2009 08:35:49
Replies
Replied 09 Jun 2009 19:41:26
09 Jun 2009 19:41:26 Heather V replied:
It has now been over 12 hours since my request and I have yet to hear a solution to my problem.
How can a product be advertised to work when it doesn't?
How can a product be advertised to work when it doesn't?
Replied 10 Jun 2009 03:35:08
10 Jun 2009 03:35:08 Mat p replied:
Below is the code from my page, I had a similar problem and the below code works fine
[]
<?php require_once('../Connections/***.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 = "../pics"; $ppu->extensions = "GIF,JPG,JPEG,BMP,PNG"; $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; } } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } 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_update"])) && ($_POST["MM_update"] == "form1")) { $updateSQL = sprintf("UPDATE tre SET title=%s, price=%s, `desc`=%s, bed=%s, bath=%s, car=%s, photo1=IFNULL(%s,photo1), photo2=IFNULL(%s,photo2), photo3=IFNULL(%s,photo3), photo4=IFNULL(%s,photo4), photo5=IFNULL(%s,photo5), photo6=IFNULL(%s,photo6), photo7=IFNULL(%s,photo7), photo8=IFNULL(%s,photo8), photo9=IFNULL(%s,photo9), photo10=IFNULL(%s,photo10) WHERE ID=%s", 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"), GetSQLValueString($_POST['ID'], "int")); mysql_select_db($database_***, $***); $Result1 = mysql_query($updateSQL, $tre) or die(mysql_error()); } $colname_Recordset1 = "-1"; if (isset($_GET['ID'])) { $colname_Recordset1 = $_GET['ID']; } mysql_select_db($database_***, $***); $query_Recordset1 = sprintf("SELECT * FROM tre WHERE ID = %s", GetSQLValueString($colname_Recordset1, "int")); $Recordset1 = mysql_query($query_Recordset1, $tre) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); ?><?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(600, 600, true); $sipp2->overwrite = false; $sipp2->setMask("##path##image_##name##.jpg"); $sipp2->saveJPEG(80); $sipp2->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(117, 117, true); $sipp3->overwrite = false; $sipp3->setMask("##path##thumb_##name##.jpg"); $sipp3->saveJPEG(80); $sipp3->process(); $sipp2GoTo = "*****.php?d=1"; if (isset($_SERVER['QUERY_STRING'])) { $sipp2GoTo .= (strpos($sipp2GoTo, '?')) ? "&" : "?"; $sipp2GoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $sipp2GoTo)); } ?>
Replied 10 Jun 2009 08:52:02
10 Jun 2009 08:52:02 Heather V replied:
Matt,
Thank you for helping with this. I thought I figured it out after five hours of staring at a computer screen, but your code helped out tremendously.
Thank you for helping with this. I thought I figured it out after five hours of staring at a computer screen, but your code helped out tremendously.
Replied 10 Jun 2009 09:25:39
10 Jun 2009 09:25:39 Mat p replied:
No probs there, I had the same frustration with the lack of support on the site. But all works out in the end.[]