Smart Image Processor PHP 2 Support Product Page

This topic was archived

Image Processor only resizes 1 of the uploaded images

Asked 08 Dec 2009 14:44:09
1
has this question
08 Dec 2009 14:44:09 Philip Marshall posted:
I am using the advanced multi uploader flash deal and I want the images to resize, but it only resizes 1 (the last in the list) that I upload. Am I doing something wrong?

Here is a screen cast of the issue:

screencast.com/t/NWRhMThiO

Please help! I am dying over here, I have a deadline to meet and purchased your extensions so that I could do so.

Replies

Replied 08 Dec 2009 14:57:28
08 Dec 2009 14:57:28 Patrick Julicher replied:
Hi Philip,

I presume you are using the latest versions of the extensions, since you only just bought them. Dooes the page with the MultiUploader have a "Restrict Access" aplied to it? If yes, please remove that and try again. Also post the source code for your page.

Kind regards, Patrick
Replied 08 Dec 2009 15:20:44
08 Dec 2009 15:20:44 Philip Marshall replied:
thanks for the quick reply!

There is NO restricted access to the page (yet) I had thought that might have been the issue, so I hadn't inserted it quite yet.

here is my code:

<?php require_once('../ScriptLibrary/incPureUpload.php'); ?>
<?php require_once('../ScriptLibrary/cGraphicMediator.php'); ?>
<?php

// Pure PHP Upload 2.1.9
$ppu = new pureFileUpload();
$ppu->path = "../image/uploads";
$ppu->extensions = "GIF,JPG,JPEG,BMP,PNG";
$ppu->formName = "form2";
$ppu->storeType = "file";
$ppu->sizeLimit = "5120";
$ppu->nameConflict = "uniq";
$ppu->requireUpload = "false";
$ppu->minWidth = "";
$ppu->minHeight = "";
$ppu->maxWidth = "";
$ppu->maxHeight = "";
$ppu->saveWidth = "";
$ppu->saveHeight = "";
$ppu->timeout = "600";
$ppu->progressBar = "blueFlashProgress.htm";
$ppu->progressWidth = "300";
$ppu->progressHeight = "100";
$ppu->redirectURL = "";
$ppu->checkVersion("2.1.9");
$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";
  }
}
?>
<?php
// Smart Image Processor PHP 2.0.6
if (isset($_GET['GP_upload'])) {
$sipp2 = new cGraphicMediator("upload", $ppu, "Filename");
$sipp2->setComponent("Auto");
$sipp2->setMatteColor("#FFFFFF");
$sipp2->resize(640, 500, true);
$sipp2->overwrite = false;
$sipp2->setMask("##path##thumb_##name##.jpg");
$sipp2->saveJPEG(80);
$sipp2->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/template1.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>DefenderRegistry.com - Tracking your Defender 90, Defender 110, and Series Land Rovers</title>
<!-- InstanceEndEditable -->
<style type="text/css">
<!--
body,td,th {
	font-family: Verdana, Geneva, sans-serif;
	font-size: 12px;
	color: #333;
}
a:link {
	color: #000;
	text-decoration: underline;
}
a:visited {
	text-decoration: underline;
	color: #000;
}
a:hover {
	text-decoration: none;
	color: #333;
}
a:active {
	text-decoration: underline;
	color: #000;
}
-->
</style>
<script type="text/javascript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
<!-- InstanceBeginEditable name="head" -->
<script></script>
<!-- InstanceEndEditable -->
</head>

<body onload="MM_preloadImages('../image/navAboutUsOver.png','../file/Gui's Hard Drive/Applications/MAMP/htdocs/defenderregistry/image/navBrowseOver.png','file/Gui's Hard Drive/Applications/MAMP/htdocs/defenderregistry/image/navImagesOver.png','file/Gui's Hard Drive/Applications/MAMP/htdocs/defenderregistry/image/navVideosOver.png','file/Gui's Hard Drive/Applications/MAMP/htdocs/defenderregistry/image/navForSaleOver.png')">
<table width="900" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="45%" align="left"><a href="../index.php"><img src="../image/Logo.png" width="362" height="112" border="0" /></a></td>
        <td width="55%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td align="right"><a href="../login.php">My Account</a> | <a href="../createAnAccount.php">Create An Account</a> | <a href="../contactUs.php">Contact Us</a> | <a href="../newsletter.php">Newsletter</a></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td align="right"><form id="form1" name="form1" method="post" action="">
              <label>
                <input type="text" name="textfield" id="textfield" />
              </label>
              <label>
                <input type="submit" name="button" id="button" value="Search" />
              </label>
            </form></td>
          </tr>
          <tr>
            <td align="right"><a href="../advancedSearch.php">Advanced Search</a></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td align="left">&nbsp;</td>
        <td valign="top">&nbsp;</td>
      </tr>
      <tr>
        <td colspan="2" align="left"><table width="100%" border="0" cellspacing="0" cellpadding="0" height="39" background="../image/navBG.png">
          <tr>
            <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="2%">&nbsp;</td>
                <td width="22%" align="center"><a href="../aboutUs.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image7','','../image/navAboutUsOver.png',')"><img src="../image/navAboutUs.png" name="Image7" width="166" height="48" border="0" id="Image7" /></a></td>
                <td width="18%" align="center"><a href="../browse.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image8','','../image/navBrowseOver.png',')"><img src="../image/navBrowse.png" name="Image8" width="141" height="48" border="0" id="Image8" /></a></td>
                <td width="18%" align="center"><a href="../images.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image9','','../image/navImagesOver.png',')"><img src="../image/navImages.png" name="Image9" width="127" height="47" border="0" id="Image9" /></a></td>
                <td width="17%" align="center"><a href="../videos.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image10','','../image/navVideosOver.png',')"><img src="../image/navVideos.png" name="Image10" width="127" height="48" border="0" id="Image10" /></a></td>
                <td width="21%" align="center"><a href="../forSale.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image11','','../image/navForSaleOver.png',')"><img src="../image/navForSale.png" name="Image11" width="161" height="48" border="0" id="Image11" /></a></td>
                <td width="2%">&nbsp;</td>
              </tr>
            </table></td>
          </tr>
        </table></td>
        </tr>
      <tr>
        <td colspan="2" align="left">&nbsp;</td>
      </tr>
      <tr>
        <td colspan="2" align="left"><!-- InstanceBeginEditable name="Body" -->
          <script language='JavaScript' src='../ScriptLibrary/incPureUpload.js' type="text/javascript"></script>
          <script language='JavaScript' src='../ScriptLibrary/incPureUpload.js' type="text/javascript"></script>
          <script language='JavaScript' src='../ScriptLibrary/incPureUpload.js' type="text/javascript"></script>
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="3%">&nbsp;</td>
              <td width="94%">Please select images that you would like to use for your Vehicle Profile. You can select as many images as you would like. Please note that images MUST be either GIF,JPG,JPEG,BMP,PNG format! You must have Flash 9 or higher for the upload feature to work! </td>
              <td width="3%">&nbsp;</td>
              </tr>
            <tr>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              </tr>
            <tr>
              <td>&nbsp;</td>
              <td align="center"><form action="<?php echo $GP_uploadAction; ?>" method="post" enctype="multipart/form-data" name="form2" id="form2" onsubmit="checkFileUpload(this,'GIF,JPG,JPEG,BMP,PNG',false,5120,'','','','','','');showProgressWindow('blueFlashProgress.htm',300,100);return document.MM_returnValue">
                <p>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,63,0" name="upload1" width="851" height="350" align="middle" id="upload1">
                    <param name="FlashVars" value="url=<?php echo urlencode($GP_uploadAction); ?>&formName=form2&bgStart=#333333&maxSize=5120&allowedExtensions=GIF,JPG,JPEG,BMP,PNG"&redirectUrl=".$ppu->redirectURL;}?>" />
                    <param name="movie" value="dmxMultiUploader.swf" />
                    <param name="quality" value="best" />
                    <param name="wmode" value="transparent" />
<embed src="dmxMultiUploader.swf" name="upload1" quality="best" flashvars="url=<?php echo urlencode($GP_uploadAction); ?>&formName=form2&bgStart=#333333&maxSize=5120&allowedExtensions=GIF,JPG,JPEG,BMP,PNG"&redirectUrl=".$ppu->redirectURL;}?>" wmode="transparent" type="application/x-shockwave-flash" width="851" height="350" pluginspage="http://www.macromedia.com/go/getflashplayer" />                  
  </object>
                  <input name="Filename" type="file" style="display:none" onchange="checkOneFileUpload(this,'GIF,JPG,JPEG,BMP,PNG',false,5120,'','','','','','')" />
                  <input type="hidden" name="Filedata" />
<script type="text/javascript">window.upload1 = document.forms["UploadQueue"].upload1;</script>
                  </p>
  </form></td>
              <td>&nbsp;</td>
              </tr>
            <tr>
              <td>&nbsp;</td>
              <td align="center">&nbsp;</td>
              <td>&nbsp;</td>
            </tr>
          </table>
        <!-- InstanceEndEditable --></td>
      </tr>
      <tr>
        <td colspan="2" align="left">&nbsp;</td>
      </tr>
      <tr>
        <td colspan="2" align="left"><img src="../image/tireSplit.png" width="902" height="13" /></td>
      </tr>
      <tr>
        <td height="21" colspan="2" align="left">&nbsp;</td>
      </tr>
      <tr>
        <td colspan="2" align="center"><a href="../termsOfService.php">Terms of Service</a> | <a href="../privacyPolicy.php">Privacy Policy</a> | <a href="../contactUs.php">Contact Us</a> | <a href="../aboutUs.php">About Us</a></td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
<!-- InstanceEnd --></html>

Replied 08 Dec 2009 15:54:53
08 Dec 2009 15:54:53 Miroslav Zografski replied:
Hello Philip,

What is your Server type, os? It is PHP compatible one but what exactly?

Regards,
Replied 08 Dec 2009 17:31:14
08 Dec 2009 17:31:14 Philip Marshall replied:
I am using an install of MAMP on my Mac.

Mac
Apache
MySQL
PHP

here is my PHP_info()

I tried to copy this in, but it was a big mess... so here is a screen cast of my phpInfo()

screencast.com/t/ZTA5MmU3N2
Replied 08 Dec 2009 19:05:35
08 Dec 2009 19:05:35 Philip Marshall replied:
could I get a reply PLEASE... sorry for my impatience here, but my deadline is approaching !!
Replied 08 Dec 2009 20:51:29
08 Dec 2009 20:51:29 Andy Simpson replied:
I would first have a look at your body onload code on line 113, where you have the name Gui's. You need to take out the apostrophe (') I would suspect this is confusing things somehow. Not too sure how filenaming on a Mac works, but if the folder is called Gui's, then rename it and adjust your code accordingly.

I would also recommend that you revise your path and remove spaces within the MM_preloadImages. Example:

Gui's Hard Drive/Applications

should really by

Guis_Hard_Drive/Applications And rename the folders accordingly.

Using this method is much better.

I am not sure if it will cure the actual issue you have, but you never know.

If you have configured the site in DW, have you set up the Remote folder and Testing Server correctly. The reason I ask, is that within the Body tag on the path for onload you have indicated the htdocs folder. Its seems you are pulling files in from outside of the actual root folder?? Example

../file/Gui's Hard Drive/Applications/MAMP/htdocs/defenderregistry/image/navBrowseOver.png

I would of thought should read;

defenderregistry/image/navBrowseOver.png

Correct if I'm wrong, but it does look odd within the code.

I would suggest, fix these first then test the multi upload again.
Replied 08 Dec 2009 21:03:38
08 Dec 2009 21:03:38 Philip Marshall replied:
fixed it, still get the same results.
Replied 08 Dec 2009 21:24:31
08 Dec 2009 21:24:31 Philip Marshall replied:
Ok, just messing around with an older upload PHP extension. And when I do the upload with NO resize, it works fine, but when I add the resize component to it. I get the following error.

Fatal error: Allowed memory size of 12582912 bytes exhausted (tried to allocate 12288 bytes) in /Applications/MAMP/htdocs/defenderregistry/uploadTest.php on line 57

What I don't understand is that the the allowed size is WAAAAY bigger then the "tried to allocate" size... so I have to have If you look at my memory in the php.ini is set to 12M that should be more then enough... so I don't know what the heck is going on... but I am sure this has something to do with it.
Replied 08 Dec 2009 21:39:28
08 Dec 2009 21:39:28 Philip Marshall replied:
Ok, so I bumped up the

memory_limit =

parameter in the .ini file all the way to 64M and that did the trick.

so

memory_limit = 64M fixed this issue.
Replied 08 Dec 2009 21:49:24
08 Dec 2009 21:49:24 Andy Simpson replied:
You may have fixed the issue, if it is related to the memory size in php.ini? But if you were to put the files on a live server, you may have the same issue again.
The memory limit may be considerably lower on the live server and so if you do not have access to the php.ini file on the server, you will need to get in touch with your host.
You may find that they will not increase the limit to what you have set on your testing machine.

I had a similar issue when doing an Estate Agents website. They were attempting to upload 5meg images, several at a time, which wasn't good. I had to advise them to reduce the actual image size to an acceptable level, before any uploading and any other image adjustments with SIP etc
Replied 11 Dec 2009 10:20:40
11 Dec 2009 10:20:40 Miroslav Zografski replied:
Hello Philip,

memory_limit limits memory used for calculation of the transformations of the pictures and it is calculated as width x height x a constant. That is why it is bigger than allocated size. If you bump on the problem when your host provider doesn't want to raze your memory_limit, depending on your application you can set certain limits in SIP so you can fit in the memory_limit.

Regards,
Replied 11 Dec 2009 10:23:23
11 Dec 2009 10:23:23 Miroslav Zografski replied:
Philip,

another thing to be aware with Multiuploader - do not place on the page common restrict access. Just make it as a conditional region depending on if the user is logged in. There is an FAQ on that matter.

Regards,

Reply to this topic