Smart Image Processor PHP 2 Support Product Page

Solved

Image not resizing nor creating thumbnail

Reported 08 Nov 2009 21:21:16
7
have this problem
08 Nov 2009 21:21:16 Chi Melville posted:
I've had the problem of Smart Image Processor PHP 2 not resizing images nor creating thumbnails when the original image is about 700KB or larger - which isn't that big by today's cameras standards. It's not appropriate that I ask & instruct my clients to resize their images before uploading them, which is what I've had to do - that's what I bought this script for.

Luckily I found the answer on this forum posted by Mat P. - thank you Mat - here's the link
wwww.dmxzone.com/forum/topic/43588/

My question is - when are you going to fix this in your script so I don't have to manually edit this each time I use it? After all, this is a paid product and the reason I bought it is to save me the time & trouble of manually editing things like this.

Are you aware of the problem? Do you have a fix planned?

Thanks,

Replies

Replied 09 Nov 2009 09:39:51
09 Nov 2009 09:39:51 Miroslav Zografski replied:
Hello Chi,

The problem can be easily solved if you place server behaviors in a particular order :
1.) PPU;
2.) SIP;
3.) Rest;

Regards,
Replied 09 Nov 2009 14:55:50
09 Nov 2009 14:55:50 Chi Melville replied:
Thanks for the reply but I'm not sure this will always solve the problem. I always place Pure PHP Upload before Smart Image Processor behaviors but always have the problem.

When you say: The problem can be easily solved if you place server behaviors in a particular order :
1.) PPU;
2.) SIP;
3.) Rest;

Do you mean that PPU & SIP have to be first? At the very top? How about the Recordset?

I would like to include a screen shot of my behaviors, but your add image button isn't working.

An example of a page that's not working has the behaviors in the following order.
1) Recordset
2) Insert Record
3) Pure PHP Upload
4) Image Processor PHP 2.0.5 ($sipp2)

What order should they be in?

Replied 09 Nov 2009 15:10:14
09 Nov 2009 15:10:14 Miroslav Zografski replied:
Hello Chi,

I haven't put that right - when applying server behaviors on the page you need to follow that order. Also you need to mind where you place a redirection. It must be at the last placed Sip(if more than 1 is applyed on the page).

Regards,
Replied 18 Jul 2010 18:42:37
18 Jul 2010 18:42:37 Andy Simpson replied:
This is pretty silly and dreadful support for an issue that has been long overdue to be fixed.

More than half way through 2010 and this and another issue related to the version check in cGraphicMediator.php file.

Highly recommended the post below to fix the issue, but surely this should have been fixed already? Thank you also to Mat for the example fix of misplaced code.

wwww.dmxzone.com/forum/topic/43588/
Replied 25 Jan 2012 18:48:26
25 Jan 2012 18:48:26 Royce Cano replied:
Wow this looks like a very old issue that still now in 2012 isnt corrected. I am very concerened as I have just purchased the mega collection for PHP and I am having issues with large images say 14 mb from a camera uploading and not being processes to a smaller file size.

This is not good, as I have checked the link provided above and my code is structured in the manner presented.

Any updates or suggestions on this would be great!


<?php require_once('../Connections/db_conn.php'); ?>
<?php require_once('../ScriptLibrary/incPureUpload.php'); ?>
<?php require_once('../ScriptLibrary/cGraphicMediator.php'); ?>
<?php
// Pure PHP Upload 2.1.12
$ppu = new pureFileUpload();
$ppu->path = "../uploads";
$ppu->extensions = "GIF,JPG,JPEG,BMP,PNG";
$ppu->formName = "form1";
$ppu->storeType = "file";
$ppu->sizeLimit = "";
$ppu->nameConflict = "uniq";
$ppu->nameToLower = true;
$ppu->requireUpload = false;
$ppu->minWidth = "";
$ppu->minHeight = "";
$ppu->maxWidth = "";
$ppu->maxHeight = "";
$ppu->saveWidth = "";
$ppu->saveHeight = "";
$ppu->timeout = "600";
$ppu->progressBar = "";
$ppu->progressWidth = "300";
$ppu->progressHeight = "100";
$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;
}
}

$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_insert"])) && ($_POST["MM_insert"] == "form1")) {
  $insertSQL = sprintf("INSERT INTO advertisement (title, modelname, price, squarefeet, beds, bath, stories, extdimensions, living, dinning, feature_1, feature_2, feature_3, feature_4, feature_5, feature_6, feature_7, feature_8, feature_9, feature_10, main_image, floor_plan_image, thumbnail_image_1, thumbnail_image_2, thumbnail_image_3, thumbnail_image_4, thumbnail_image_5, thumbnail_image_6) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                       GetSQLValueString($_POST['title'], "text"),
                       GetSQLValueString($_POST['modelname'], "text"),
                       GetSQLValueString($_POST['price'], "text"),
                       GetSQLValueString($_POST['squarefeet'], "text"),
                       GetSQLValueString($_POST['beds'], "text"),
                       GetSQLValueString($_POST['bath'], "text"),
                       GetSQLValueString($_POST['stories'], "text"),
                       GetSQLValueString($_POST['extdimensions'], "text"),
                       GetSQLValueString($_POST['living'], "text"),
                       GetSQLValueString($_POST['dinning'], "text"),
                       GetSQLValueString($_POST['feature_1'], "text"),
                       GetSQLValueString($_POST['feature_2'], "text"),
                       GetSQLValueString($_POST['feature_3'], "text"),
                       GetSQLValueString($_POST['feature_4'], "text"),
                       GetSQLValueString($_POST['feature_5'], "text"),
                       GetSQLValueString($_POST['feature_6'], "text"),
                       GetSQLValueString($_POST['feature_7'], "text"),
                       GetSQLValueString($_POST['feature_8'], "text"),
                       GetSQLValueString($_POST['feature_9'], "text"),
                       GetSQLValueString($_POST['feature_10'], "text"),
                       GetSQLValueString($_POST['main_image'], "text"),
                       GetSQLValueString($_POST['floor_plan_image'], "text"),
                       GetSQLValueString($_POST['thumbnail_image_1'], "text"),
                       GetSQLValueString($_POST['thumbnail_image_2'], "text"),
                       GetSQLValueString($_POST['thumbnail_image_3'], "text"),
                       GetSQLValueString($_POST['thumbnail_image_4'], "text"),
                       GetSQLValueString($_POST['thumbnail_image_5'], "text"),
                       GetSQLValueString($_POST['thumbnail_image_6'], "text"));

  mysql_select_db($database_db_conn, $db_conn);
  $Result1 = mysql_query($insertSQL, $db_conn) or die(mysql_error());

  $insertGoTo = "index.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
}

mysql_select_db($database_db_conn, $db_conn);
$query_Recordset1 = "SELECT * FROM advertisement";
$Recordset1 = mysql_query($query_Recordset1, $db_conn) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<?php
// Smart Image Processor PHP 2.0.9
if (isset($_GET['GP_upload'])) {
$main = new cGraphicMediator("upload", $ppu, "main_image");
$main->setComponent("Auto");
$main->setMatteColor("#FFFFFF");
$main->resizeEx(10, 10, true, true);
$main->overwrite = true;
$main->save();
$main->process();
}
?>
<?php
// Smart Image Processor PHP 2.0.9
if (isset($_GET['GP_upload'])) {
$fplan = new cGraphicMediator("upload", $ppu, "");
$fplan->setComponent("Auto");
$fplan->setMatteColor("#FFFFFF");
$fplan->resizeEx(700, 400, true, false);
$fplan->overwrite = true;
$fplan->save();
$fplan->process();
}
?>
<?php
// Smart Image Processor PHP 2.0.9
if (isset($_GET['GP_upload'])) {
$th1 = new cGraphicMediator("upload", $ppu, "thumbnail_image_1");
$th1->setComponent("Auto");
$th1->setMatteColor("#FFFFFF");
$th1->resizeEx(220, 220, true, false);
$th1->overwrite = true;
$th1->save();
$th1->process();
}
?>
<?php
// Smart Image Processor PHP 2.0.9
if (isset($_GET['GP_upload'])) {
$th2 = new cGraphicMediator("upload", $ppu, "thumbnail_image_2");
$th2->setComponent("Auto");
$th2->setMatteColor("#FFFFFF");
$th2->resizeEx(220, 220, true, false);
$th2->overwrite = true;
$th2->save();
$th2->process();
}
?>
<?php
// Smart Image Processor PHP 2.0.9
if (isset($_GET['GP_upload'])) {
$th3 = new cGraphicMediator("upload", $ppu, "thumbnail_image_3");
$th3->setComponent("Auto");
$th3->setMatteColor("#FFFFFF");
$th3->resizeEx(220, 220, true, false);
$th3->overwrite = true;
$th3->save();
$th3->process();
}
?>
<?php
// Smart Image Processor PHP 2.0.9
if (isset($_GET['GP_upload'])) {
$th4 = new cGraphicMediator("upload", $ppu, "thumbnail_image_4");
$th4->setComponent("Auto");
$th4->setMatteColor("#FFFFFF");
$th4->resizeEx(220, 220, true, false);
$th4->overwrite = true;
$th4->save();
$th4->process();
}
?>
<?php
// Smart Image Processor PHP 2.0.9
if (isset($_GET['GP_upload'])) {
$th5 = new cGraphicMediator("upload", $ppu, "thumbnail_image_5");
$th5->setComponent("Auto");
$th5->setMatteColor("#FFFFFF");
$th5->resizeEx(220, 220, true, false);
$th5->overwrite = true;
$th5->save();
$th5->process();
}
?>
<?php
// Smart Image Processor PHP 2.0.9
if (isset($_GET['GP_upload'])) {
$th6 = new cGraphicMediator("upload", $ppu, "thumbnail_image_6");
$th6->setComponent("Auto");
$th6->setMatteColor("#FFFFFF");
$th6->resizeEx(220, 220, true, false);
$th6->overwrite = true;
$th6->save();
$th6->process();
}
?>

Replied 25 Jan 2012 21:03:03
25 Jan 2012 21:03:03 Andy Simpson replied:
Are the files being uploaded to the server?

I think one of your problems may be the fact the file size of each image (14mb) is quite high and possibly why its not necessarily doing the job of re-sizing, its the time it will take the server to process also, especially if you are on a shared hosting space.

Try a test with just one file upload and the re-size process.

Let me know how you get on.

My advice from developing a few estate agent websites, is scale the images to a manageable size and optimise. Then use these as the files that get uploaded. You will save yourself lots of headaches.
Replied 25 Jan 2012 23:28:40
25 Jan 2012 23:28:40 Royce Cano replied:
I have this running on a dedicated linux box with only one site on it, this site. I bimped up the php.ini to 10000MB and when loading 1 large file by its self its not working. Smaller files work, its just when a large file from say a digital cam is loaded it dies on me.
I also increased the time out to 1000 with no luck.

To get specific, it will upload the image but it wont resize it. for some reason if the image is small it will resize, but if the image is large it just uploads, kinda pointless if you ask me.

Any thoughts?
Replied 26 Jan 2012 08:03:16
26 Jan 2012 08:03:16 Teodor Kuduschiev replied:
Hello,

Do you get any
Quote( ! ) Fatal error
messages?

what exactly in php.ini you set to 10000?
upload_max_filesize, post_max_size, memory_limit need to have proper settings set.
Replied 26 Jan 2012 18:08:01
26 Jan 2012 18:08:01 Royce Cano replied:
No, no error message. It just uploads the file with out processing it. I have insured that imagemagic is installed as well as gd2 using PHP Info.

It as if the upload works, the DB write works just skips resize on upload. AS you can see I have the latest versioin of PPU and SIP

upload_max_filesize = 1000M
post_max_size = 1000M
memory_limit = 512M

All set above what is needed.

Do you want me to copy and paste my entire PHP.INI?

Replied 02 Feb 2012 22:36:18
02 Feb 2012 22:36:18 Royce Cano replied:
Hmm no response.
Replied 03 Feb 2012 00:27:34
03 Feb 2012 00:27:34 Andy Simpson replied:
Have you tried to process any images a lot smaller than 14 meg as from your original post. As my previous message, I am still suspecting it is related to the filesize of the images being so large.
Replied 03 Feb 2012 00:32:59
03 Feb 2012 00:32:59 Royce Cano replied:
Yes, smaller files work. Im very frustrated, because I canot use the flash multifile uploader in this case. I am kinda at a lost, I bought this extension just for this project and now im stuck up a creek. NO FUN!
Replied 03 Feb 2012 00:39:50
03 Feb 2012 00:39:50 Royce Cano replied:
I actually removed the sipp and just tested with file upload and it looks like multiple files over 3 is where it clunks out. I cannot use flash so I am hosed

ive played around with rediculous settings in PHP.ini. No luck. Grr.
Replied 03 Feb 2012 00:55:55
03 Feb 2012 00:55:55 Andy Simpson replied:
So the issue looks like the 14 meg filesize?

I would weigh up whether the uploading of the images directly from the camera is actually a necessity. If it isn't then batch processing the images off the camera through Photoshop or some other graphics software first to a more manageable size would be your answer.

I came across this situation with an estate agent who wanted to upload directly from his camera a Nikon, before I reminded him that the photos would need to be processed first for printed literature etc. Once he realised this he got hold of some cheap graphics software batch processed the images for print then used them for uploading and rescaling for the website.

You got to weigh up the pros and cons and ease of use for the client.
Replied 03 Feb 2012 01:26:37
03 Feb 2012 01:26:37 Royce Cano replied:
Unfortunatley this is app is for people who have limited computer knowledge. I am going to have to look at another solution. I think what I will do is upload on file at a time, then process each file while its on the server I guess in the background. I tried using 3MB files but still it chokes if I do more than 4. Thanks for your help. Most Appreciated!
Replied 03 Feb 2012 01:51:41
03 Feb 2012 01:51:41 Andy Simpson replied:
No worries, good luck!
This reply was removed on 8/8/2012 2:50:18 AM.
See the changelog
Replied 13 Jul 2013 15:56:19
13 Jul 2013 15:56:19 junaidi wahadi replied:
shame that this extensions was poor on documentation..
I just found a solutions..
add this code


if (isset($editFormAction)) {  
  if (isset($_SERVER['QUERY_STRING'])) {  
      if (!preg_match('/.jpg/i',"GP_upload=true", $_SERVER['QUERY_STRING'])) {  
      $editFormAction .= "&GP_upload=true";  
        }  
  } else {  
    $editFormAction .= "?GP_upload=true";  
  }  
}  


before this line :

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"]


to make the form work with spry validation on form submit add this :

< form onsubmit="if (Spry.Widget.Form.validate(this)){<?php echo $ppu->getSubmitCode() ?>;return document.MM_returnValue;} else {return false;}" >


its work like a charm for me on.
pure php upload 3.0.1 and Smart Image Processor 2.1.0


Replied 06 Apr 2014 14:24:06
06 Apr 2014 14:24:06 reinhardt ellis replied:
When is this solution going to be implemented with the extension?

if (isset($editFormAction)) {
if (isset($_SERVER['QUERY_STRING'])) {
if (!preg_match('/.jpg/i',"GP_upload=true", $_SERVER['QUERY_STRING'])) {
$editFormAction .= "&GP_upload=true";
}
} else {
$editFormAction .= "?GP_upload=true";
}
}
Replied 27 Nov 2014 02:25:22
27 Nov 2014 02:25:22 Juan Olarte replied:
Hi I have been experiencing the same issue.
The file is uploading but it doesn’t want to resize. I am not sure what to do. I have been working at this for the past 2 days and no matter what I do or order it is on, still it doesn’t work.
Can someone help me?
Thanks
Replied 27 Nov 2014 06:18:26
27 Nov 2014 06:18:26 reinhardt ellis replied:
Just replace 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";
  }
}


with this code below and it works great

if (isset($editFormAction)) {
if (isset($_SERVER['QUERY_STRING'])) {
if (!preg_match('/.jpg/i',"GP_upload=true", $_SERVER['QUERY_STRING'])) {
$editFormAction .= "&GP_upload=true";
}
} else {
$editFormAction .= "?GP_upload=true";
}
} 


Replied 27 Nov 2014 23:09:28
27 Nov 2014 23:09:28 Juan Olarte replied:
Hi Reinhardt,
Thanks for getting back to me! Unfortunately, I don't have that in my code.
Please what I get when I do the extension.
<?php
//*** Pure PHP File Upload 3.1.0
// Process form fm_Cover
$ppu = new pureFileUpload();
$ppu->nameConflict = "uniq";
$ppu->storeType = "file";
$ppu->progressBar = "html5.htm";
$ppu->progressWidth = 350;
$ppu->progressHeight = 150;
$uploadCom_Cover = $ppu->files("Com_Cover";
$uploadCom_Cover->path = "Profile_Images/Company/Marketing";
$uploadCom_Cover->required = true;
$uploadCom_Cover->allowedExtensions = "GIF,JPG,JPEG,BMP,PNG,JPE"; // "custom"
$ppu->redirectUrl = "";
$ppu->checkVersion("3.1.0";
$ppu->doUpload();
if ($ppu->done) {
$_POST["undefined"] = undefined;
$_POST["undefined"] = undefined;
}
?>
<?php
// Smart Image Processor PHP 2.1.1
if (isset($_GET['GP_upload'])) {
$sipp2 = new cGraphicMediator("upload", $ppu, "Com_Cover";
$sipp2->setComponent("Auto";
$sipp2->setMatteColor("#FFFFFF";
$sipp2->resizeEx(851, 315, true, true);
$sipp2->sharpen();
$sipp2->overwrite = true;
$sipp2->saveJPEG(100);
$sipp2->process();
}
?>
Replied 26 Dec 2014 20:00:06
26 Dec 2014 20:00:06 Michael Bosquez replied:
Miro's answer above is not accurate. I've tried every order possible and none of them allow resize. The only way resize works is if I remove the Insert Record behavior. Seriously useless extension if you can't use it with an Insert Record behavior.

Mike
Replied 27 Dec 2014 18:39:56
27 Dec 2014 18:39:56 Michael Bosquez replied:
Well, the extension doesn't work on a recordset. I can only get it to work when used with Pure PHP Upload 3 and no Insert Record behavior, or when resizing a folder. Further, and consistent with other posts in this forum, it will not resize anything right out of a digital camera. I can resize a folder as long as the original images are small. I uploaded one from my digital camera that is over 5M and I get a fatal memory error.

Not a very useful extension. Debating whether I'll demand a refund. And if I do, and they won't grant it, then I'll dispute it with PayPal. I just bought this extension a few days ago and it does not work as advertised. The posts in this forum say a lot about the issues with the extension and over the past 3 to 4 years DMXZone has done nothing to fix it.

Has anyone out there found a resizing extension from someone else that actually works?

Thanks,
Mike
Replied 29 Dec 2014 15:45:09
29 Dec 2014 15:45:09 Michael Bosquez replied:
All,

I purchased and tested the upload, insert, and resize extension from DWZone-it.com and it works great! It does not have any of the issues reported all over the DMXZone site for their resize extension. The DWZone-it.com extension is available here:

www.dwzone-it.com/Extension/PhpUploadResize/default.asp

Mike

Reply to this topic