Pure PHP Upload 2 Support Product Page

Smart Image Processor PHP 2.0.7 will not show thumbs on update

Asked 05 May 2010 07:26:05
1
has this question
05 May 2010 07:26:05 Mat p posted:
I have been using this add on for some time now, and have ran into problems again with this image upload.
I have it working 100% in the insert but when I try to update the image it only uploads the original not the re-size or thumbnail images.

i have been over this 100 times on other sites I have used this on but I cannot see anything different.

I'm using CS4 on windows 7 if that makes any difference.

here is my code.

<?php
// check session
session_start();
if(!isset($HTTP_SESSION_VARS['xxx'])){
	header("Location: ../index.php");
}
?>
<?php require_once('../Connections/xxx.php'); ?>
<?php require_once('../ScriptLibrary/cGraphicMediator.php'); ?>
<?php require_once('../ScriptLibrary/incPureUpload.php'); ?>
<?php
// Pure PHP Upload 2.1.10
$ppu = new pureFileUpload();
$ppu->path = "../photo";
$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.10");
$ppu->doUpload();

if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $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 property SET heading=%s, price=%s, web_ID=%s, cat=%s, status=%s, address=%s, suburb=%s, postcode=%s, bed=%s, bath=%s, car=%s, `desc`=%s, Photo1=IFNULL(%s,Photo1), Photo2=IFNULL(%s,Photo2), Photo3=IFNULL(%s,Photo3), Photo4=IFNULL(%s,Photo4), Photo5=%s, Photo6=IFNULL(%s,Photo6), Photo7=IFNULL(%s,Photo7), Photo8=IFNULL(%s,Photo8), Photo9=IFNULL(%s,Photo9), Photo10=IFNULL(%s,Photo10), dis_address=%s, feature=%s, opentime=%s, `datetime`=%s, agent_ID=%s WHERE ID=%s",
                       GetSQLValueString($_POST['heading'], "text"),
                       GetSQLValueString($_POST['price'], "text"),
                       GetSQLValueString($_POST['web_ID'], "text"),
                       GetSQLValueString($_POST['cat'], "text"),
                       GetSQLValueString($_POST['status'], "text"),
                       GetSQLValueString($_POST['address'], "text"),
                       GetSQLValueString($_POST['suburb'], "text"),
                       GetSQLValueString($_POST['postcode'], "text"),
                       GetSQLValueString($_POST['bed'], "text"),
                       GetSQLValueString($_POST['bath'], "text"),
                       GetSQLValueString($_POST['car'], "text"),
                       GetSQLValueString($_POST['desc'], "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['showadd'], "text"),
                       GetSQLValueString($_POST['feature'], "text"),
                       GetSQLValueString($_POST['opentime'], "text"),
                       GetSQLValueString($_POST['datetime'], "text"),
                       GetSQLValueString($_POST['agent_ID'], "text"),
                       GetSQLValueString($_POST['ID'], "int"));

  mysql_select_db($database_Conn_xxx, $Conn_xxx);
  $Result1 = mysql_query($updateSQL, $Conn_xxx) or die(mysql_error());

  $updateGoTo = "../xxx/xxx.php?d=1";
  if (isset($_SERVER['QUERY_STRING'])) {
    $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
    $updateGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $updateGoTo));
}

$colname_Recordset1 = "-1";
if (isset($_GET['ID'])) {
  $colname_Recordset1 = $_GET['ID'];
}
mysql_select_db($database_Conn_xxx, $Conn_xxx);
$query_Recordset1 = sprintf("SELECT * FROM property WHERE ID = %s", GetSQLValueString($colname_Recordset1, "int"));
$Recordset1 = mysql_query($query_Recordset1, $Conn_xxx) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);

mysql_select_db($database_xxx_xxx, $Conn_xxx);
$query_Recordset2 = "SELECT * FROM Staff";
$Recordset2 = mysql_query($query_Recordset2, $Conn_xxx) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);
?>
<?php
// Smart Image Processor PHP 2.0.7
if (isset($_GET['GP_upload'])) {
$sipp2 = new cGraphicMediator("upload", $ppu, "");
$sipp2->setComponent("Auto");
$sipp2->setMatteColor("#FFFFFF");
$sipp2->resize(700, 700, true);
$sipp2->setFontFamily("arena_condensed.ttf");
$sipp2->setFontSize(14);
$sipp2->setFontColor("#FFFFFF");
$sipp2->setBold(false);
$sipp2->setItalic(false);
$sipp2->setUnderline(false);
$sipp2->addText("xxxx","Bottom-Left");
$sipp2->overwrite = true;
$sipp2->saveJPEG(80);
$sipp2->process();
}
?>
<?php
// Smart Image Processor PHP 2.0.7
if (isset($_GET['GP_upload'])) {
$sipp12 = new cGraphicMediator("upload", $ppu, "");
$sipp12->setComponent("Auto");
$sipp12->setMatteColor("#FFFFFF");
$sipp12->resize(250, 250, true);
$sipp12->overwrite = false;
$sipp12->setMask("##path##thumb_##name##.jpg");
$sipp12->saveJPEG(80);
$sipp12->process();
}
?>
<?php
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
?>


Edited by - Mat p on 05 May 2010  07:31:44

Replies

Replied 05 May 2010 09:55:28
05 May 2010 09:55:28 Miroslav Zografski replied:
Hello Mat,

Do following:
remove all of the server behaviors on set on the page then apply all again in following order:
1.PPU;
2.SIP1;
3.SIP2;
4.Recordset;
5.Update;

Regards,
Replied 05 May 2010 15:11:13
05 May 2010 15:11:13 Mat p replied:
Thanks have tried this but no go.
Replied 05 May 2010 15:55:21
05 May 2010 15:55:21 Miroslav Zografski replied:
Hello Mat,

Remove the redirect from the Update and give it a try again.

Regards,
Replied 06 May 2010 01:46:22
06 May 2010 01:46:22 Mat p replied:
hello, thanks for your assistance but know it will not update any fields.
I did not place a redirect on the update and it still stopped working.

Also why does it place
      <script src='../ScriptLibrary/incPureUpload.js' type="text/javascript"></script>

This JavaScript in 5 times, shouldn't this be in the head tag?
Replied 10 May 2010 10:00:57
10 May 2010 10:00:57 Miroslav Zografski replied:
Hello Mat,

Could you, please, provide the page in question to my e-mail:


Regards,

Reply to this topic