Pure PHP Upload 2 Support Product Page

Answered

Upload once, create two images (large & thumb) in two different folders?

Asked 05 Aug 2010 16:52:52
1
has this question
05 Aug 2010 16:52:52 Murray Summers posted:
I'm using PPU and SIPP with the following code -

<?php require_once('ScriptLibrary/incPureUpload.php'); ?>
<?php require_once('ScriptLibrary/cGraphicMediator.php'); ?>
<?php
// Pure PHP Upload 2.1.10
$ppu = new pureFileUpload();
$ppu->path = "_img/gallery/full";
$ppu->extensions = "GIF,JPG,JPEG,PNG";
$ppu->formName = "form1";
$ppu->storeType = "file";
$ppu->sizeLimit = "";
$ppu->nameConflict = "over";
$ppu->requireUpload = "true";
$ppu->minWidth = "";
$ppu->minHeight = "";
$ppu->maxWidth = "";
$ppu->maxHeight = "";
$ppu->saveWidth = "";
$ppu->saveHeight = "";
$ppu->timeout = "600";
$ppu->progressBar = "fileCopyProgress.htm";
$ppu->progressWidth = "300";
$ppu->progressHeight = "100";
$ppu->redirectURL = "";
$ppu->checkVersion("2.1.10";
$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.7
if (isset($_GET['GP_upload'])) {
$sipp2 = new cGraphicMediator("upload", $ppu, "";
$sipp2->setComponent("Auto";
$sipp2->setMatteColor("#FFFFFF";
$sipp2->resize(750, 500, true);
$sipp2->overwrite = true;
$sipp2->saveJPEG(80);
$sipp2->process();
}
?>
<?php
// Smart Image Processor PHP 2.0.7
if (isset($_GET['GP_upload'])) {
$sipp3 = new cGraphicMediator("upload", $ppu, "";
$sipp3->setComponent("Auto";
$sipp3->setMatteColor("#FFFFFF";
$sipp3->resize(263, 175, true);
$sipp3->overwrite = false;
$sipp3->setMask("##_img/gallery/thumbs/##name##.jpg";
$sipp3->saveJPEG(80);
$sipp3->process();
}
?>

My intention is to upload a raw image, resize to "large size" and save in the 'full' folder, then resize again to "thumb" and save in the 'thumbs' folder. I do not want to rename the image in the process. The code pasted above works for the initial resizing, but I'm not getting the thumb image created. What am I doing wrong, please?

Promoted Answers

Replied 06 Aug 2010 10:09:15
Hello Murray,

Your mask for the thumbnail resize SIP is not quite correct. It must look like :
##path##/thumbs/##name##.jpg
that will result in :
_img/gallery/full/thumbs/originalFileName.jpg

If you like to set the thumb folder to other location different from the "large" files location do following:
_img/gallery/thumbs/##name##.jpg

Regards,

Replies

Replied 06 Aug 2010 10:09:15
06 Aug 2010 10:09:15 Miroslav Zografski replied:
Hello Murray,

Your mask for the thumbnail resize SIP is not quite correct. It must look like :
##path##/thumbs/##name##.jpg
that will result in :
_img/gallery/full/thumbs/originalFileName.jpg

If you like to set the thumb folder to other location different from the "large" files location do following:
_img/gallery/thumbs/##name##.jpg

Regards,
Replied 06 Aug 2010 15:13:43
06 Aug 2010 15:13:43 Murray Summers replied:
QuoteHello Murray,

Your mask for the thumbnail resize SIP is not quite correct. It must look like :
##path##/thumbs/##name##.jpg
that will result in :
_img/gallery/full/thumbs/originalFileName.jpg

If you like to set the thumb folder to other location different from the "large" files location do following:
_img/gallery/thumbs/##name##.jpg

Regards,


Thanks, Miroslav - that worked just fine. Don't know why I couldn't figure that one out!
Replied 09 Aug 2010 09:56:21
09 Aug 2010 09:56:21 Miroslav Zografski replied:
Hello Murray,

You are welcome.

Regards,

Reply to this topic