Smart Image Processor PHP 2 Support Product Page

Answered

Second SIP for 'thumbs' doesn't work anymore.

Asked 09 Jul 2012 03:49:42
1
has this question
09 Jul 2012 03:49:42 Heather V posted:
I have Advanced Multi Uploader with SIP 2.0.9 installed.

This product SIP DID work at one point and time to the 'thumbs' folder and then it QUIT working, so I uninstalled all of the behaviors and reinstalled them. I have even compared the code to a different site that I have used the same behaviors on AND IT WORKS on the other site, not this one.

So, AMU works as well as uploading the first SIP, but it will not upload to the thumbs folder with the second SIP. Why?

Yes, permissions is set correctly.
Yes, I've already read the order of the way the Server Behaviors should be installed
Yes, I've tried a variety of ways for the second SIP to post to the 'thumbs' folder based upon www.dmxzone.com/go?16935.

Still no luck.

How can a code just quit working and not work after being reinstalled?

<?php require_once('../../../../Connections/.php'); ?>
<?php require_once('../../../../ScriptLibrary/incPureUpload.php'); ?>
<?php require_once('../../../../ScriptLibrary/cGraphicMediator.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
// Pure PHP Upload 2.1.12
$ppu = new pureFileUpload();
$ppu->path = "../../../../images/photogallery";
$ppu->extensions = "GIF,JPG,JPEG,BMP,PNG,gif,jpg,jpeg,bmp,png";
$ppu->formName = "UploadQueue";
$ppu->storeType = "file";
$ppu->sizeLimit = "";
$ppu->nameConflict = "uniq";
$ppu->nameToLower = false;
$ppu->requireUpload = true;
$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.12");
$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;
}
}

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"] == "UploadQueue")) {
  $insertSQL = sprintf("INSERT INTO gallery (filename) VALUES (%s)",
                       GetSQLValueString($_POST['Filedata'], "text"));

  mysql_select_db($database_Tr_adconr25_jut, $Tr_adconr25_jut);
  $Result1 = mysql_query($insertSQL, $Tr_adconr25_jut) or die(mysql_error());
}

$var1_getCat = "-1";
if (isset($_GET['cat_id'])) {
  $var1_getCat = $_GET['cat_id'];
}
mysql_select_db($database_Tr_adconr25_jut, $Tr_adconr25_jut);
$query_getCat = sprintf("SELECT * FROM  gal_category WHERE  gal_category.cat_id = %s", GetSQLValueString($var1_getCat, "int"));
$getCat = mysql_query($query_getCat, $Tr_adconr25_jut) or die(mysql_error());
$row_getCat = mysql_fetch_assoc($getCat);
$totalRows_getCat = mysql_num_rows($getCat);
?>
<?php
// Smart Image Processor PHP 2.0.9
if (isset($_GET['GP_upload'])) {
$sipp1 = new cGraphicMediator("upload", $ppu, "");
$sipp1->setComponent("Auto");
$sipp1->setMatteColor("#000000");
$sipp1->resizeEx(500, 375, true);
$sipp1->overwrite = true;
$sipp1->saveJPEG(80);
$sipp1->process();
}
?>
<?php
// Smart Image Processor PHP 2.0.9
if (isset($_GET['GP_upload'])) {
$sipp2 = new cGraphicMediator("upload", $ppu, "");
$sipp2->setComponent("Auto");
$sipp2->setMatteColor("#000000");
$sipp2->resizeEx(90, 68, true, false);
$sipp2->overwrite = false;
$sipp2->setMask("##path##/thumbs/##name##.jpg");
$sipp2->saveJPEG(90);
$sipp2->process();
}
?>
<?php
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
?>
<!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" />
<link href="../../../styles/mainly-h.css" rel="stylesheet" type="text/css" media="screen" />
<link rel="shortcut icon" href="../../favicon.ico" type="image/x-icon" /> 
<link rel="icon" href="../../favicon.ico" type="image/x-icon" />
<script src="../../../Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<style type="text/css">
<!--
ul {
	margin: 1em;
}

ul li {
	line-height: 200%;
}

ul li a {
	color: #333;
}
-->
</style>
<script language='JavaScript' src='../../../../ScriptLibrary/incPureUpload.js' type="text/javascript"></script>
</head>

<body>
<div id="wrapper">
     <h1>INSERT - Photo Gallery </h1>
     <ul>
          <li>This form is to insert new images for the photo gallery</li>
          <li>Existing filenames will be given a unique filename</li>
          <li>After upload of images, return to the '<a href="list.php">Photo List</a>' page to select and edit your most recently uploaded files to select a Category and add a Caption for your image.</li>
     </ul>
     <div style="margin-left: auto; margin-right: auto; width: 540px; border-size: 2px 3px 3px 2px; border-top: #999999; border-right: #666666; border-bottom: #666; border-left: #999; border-style: solid;">
          <form action="<?php echo $editFormAction; ?>" method="POST" enctype="multipart/form-data" name="UploadQueue" id="UploadQueue" onsubmit="checkFileUpload(this,'GIF,JPG,JPEG,BMP,PNG,gif,jpg,jpeg,bmp,png',true,'','','','','','','');return document.MM_returnValue">
               <input name="Filename" type="file" style="display:none" onchange="checkOneFileUpload(this,'GIF,JPG,JPEG,BMP,PNG,gif,jpg,jpeg,bmp,png',true,'','','','','','','')" />
               <script type="text/javascript">window.upload1 = document.forms["UploadQueue"].upload1;</script>
               <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,63,0" width="518" height="341" id="upload1" align="middle">
                    <param name="FlashVars" value="url=<?php echo urlencode($GP_uploadAction); ?>&formName=UploadQueue&FlashUpload=true<?php if ($ppu->redirectURL <> '') {echo "&redirectUrl=".$ppu->redirectURL;}?>" />
                    <param name="movie" value="dmxMultiUploader.swf" />
                    <param name="quality" value="best" />
                    <param name="wmode" value="transparent" />
                    <!--[if !IE]>-->
                    <embed src="dmxMultiUploader.swf" name="upload1" quality="best" flashvars="url=<?php echo urlencode($GP_uploadAction); ?>&formName=UploadQueue&FlashUpload=true<?php if ($ppu->redirectURL <> '') {echo "&redirectUrl=".$ppu->redirectURL;}?>" wmode="transparent" type="application/x-shockwave-flash" width="518" height="341" pluginspage="http://www.macromedia.com/go/getflashplayer" />
                    <!--<![endif]-->
               </object>
               <input name="Filename2" type="file" style="display:none" onchange="checkOneFileUpload(this,'GIF,JPG,JPEG,BMP,PNG,gif,jpg,jpeg,bmp,png',true,'','','','','','','')" />
               <input type="hidden" name="Filedata" />
<script type="text/javascript">window.upload1 = document.forms["UploadQueue"].upload1;</script>
               <input type="hidden" name="MM_insert" value="UploadQueue" />
          </form>
     </div>
     <p class="adminmenu"><a href="../../menu.php"><img src="../../../../images/admin-imgs/admin.jpg" alt="" width="26" height="25" title="Admin Menu" /></a><a href="<?php echo $logoutAction ?>"><img src="../../../../images/admin-imgs/logout.jpg" alt=""  title="Log Out" /></a></p>
</div>
</body>
</html>
<?php
mysql_free_result($getCat);
?>


Replies

Replied 09 Jul 2012 06:36:27
09 Jul 2012 06:36:27 Miroslav Zografski replied:
Hello Heather,

In your page find following code:
$editFormAction = $_SERVER['PHP_SELF'];  
if (isset($_SERVER['QUERY_STRING'])) {  
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);  
}  

And move it above this code:
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";  
  }  
}  

Save and test the page.

Regards.
Replied 09 Jul 2012 06:36:28
09 Jul 2012 06:36:28 Miroslav Zografski replied:
Hello Heather,

In your page find following code:
$editFormAction = $_SERVER['PHP_SELF'];  
if (isset($_SERVER['QUERY_STRING'])) {  
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);  
}  

And move it above this code:
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";  
  }  
}  

Save and test the page.

Regards.
Replied 30 Mar 2013 22:48:20
30 Mar 2013 22:48:20 phil vouers replied:
Just or information to others.. This problem can be avoided by doing things in a certain order.
1.create form
2.make recordset
3.set upload server behavior
4. then add file upload and image resizing

This problem was driving me nutso also but Miro's answer put me on track to solving it

Reply to this topic