Thumbnail creation and insert record

Can anyone help with this issue please, I just cant seem to work it out.

I have a page where a user uploads an image, and as part of the upload process a thumbnail image is created in the same folder and with the prefix of ‘t-’ (eg: t-image). So far so good all works fine. However when I (using Dreamweaver 8) add the function to insert a record in the database the thumbnail is no longer created, however the file still uploads and is entered into the database.

My question is can anyone see what I’m doing wrong as I think I may not be able to see the trees for the wood. The code is below:

[php]

<?php require_once('../Connections/Bootshare.php'); ?><?php

if (!isset($_SESSION)) {
session_start();
}
$MM_authorizedUsers = “Live”;
$MM_donotCheckaccess = “false”;

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;

// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == “”) && false) {
$isValid = true;
}
}
return $isValid;
}

$MM_restrictGoTo = “http://www.bootshare.com/login.php”;
if (!((isset($_SESSION[‘MM_Username’])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION[‘MM_Username’], $_SESSION[‘MM_UserGroup’])))) {
$MM_qsChar = “?”;
$MM_referrer = $_SERVER[‘PHP_SELF’];
if (strpos($MM_restrictGoTo, “?”)) $MM_qsChar = “&”;
if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= “?” . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . “accesscheck=” . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>

<?php require_once('../ScriptLibrary/incPureUpload.php'); ?> <?php require_once('../ScriptLibrary/cGraphicMediator.php'); ?> <?php // Pure PHP Upload 2.1.12 $ppu = new pureFileUpload(); $ppu->path = "../gallery/".$_SESSION['MM_Username']; $ppu->extensions = "GIF,JPG,JPEG,PNG"; $ppu->formName = "gallupload"; $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(); ?> <?php //START OF RECORDSET if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $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"] == "gallupload")) { $insertSQL = sprintf("INSERT INTO gallery (gallfile, galltitle, gallowner, gallstatus, galldate, DSF, DSM, DST, DSB, ownercomment, ownership, gallmain) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['gallfile'], "text"), GetSQLValueString($_POST['galltitle'], "text"), GetSQLValueString($_POST['gallowner'], "text"), GetSQLValueString($_POST['gallstatus'], "text"), GetSQLValueString($_POST['galldate'], "date"), GetSQLValueString($_POST['DSF'], "text"), GetSQLValueString($_POST['DSM'], "text"), GetSQLValueString($_POST['DST'], "text"), GetSQLValueString($_POST['DSB'], "text"), GetSQLValueString($_POST['ownercomment'], "text"), GetSQLValueString($_POST['ownership'], "text"), GetSQLValueString($_POST['gallmain'], "text")); mysql_select_db($database_Bootshare, $Bootshare); $Result1 = mysql_query($insertSQL, $Bootshare) or die(mysql_error()); } $colname_gallmembers = "-1"; if (isset($_SESSION['MM_Username'])) { $colname_gallmembers = (get_magic_quotes_gpc()) ? $_SESSION['MM_Username'] : addslashes($_SESSION['MM_Username']); } mysql_select_db($database_Bootshare, $Bootshare); $query_gallmembers = sprintf("SELECT username, firstname, lastname, membertype, lastlogon, status, postgallery FROM members WHERE username = %s", GetSQLValueString($colname_gallmembers, "text")); $gallmembers = mysql_query($query_gallmembers, $Bootshare) or die(mysql_error()); $row_gallmembers = mysql_fetch_assoc($gallmembers); $totalRows_gallmembers = mysql_num_rows($gallmembers); //END OF RECORDSET ?><?php

// Smart Image Processor PHP 2.1.1
if (isset($_GET[‘GP_upload’])) {
$sipp2 = new cGraphicMediator(“upload”, $ppu, “”);
$sipp2->setComponent(“Auto”);
$sipp2->setMatteColor("#FFFFFF");
$sipp2->resizeEx(50, 1000, true, false);
$sipp2->overwrite = false;
$sipp2->setMask("##path##t-##filename##");
$sipp2->save();
$sipp2->process();
}
?>

<?php $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } ?> Bootshare.com - The online forum dedicated to all things boots.
<?php require("../assets/structure-bannerline.php"); ?>

Got something to show?

Upload your photos here, dont forget to tag your photo and make sure it meets the guidelines.


 
This image needs tagging as showing....
Women: No Yes  
Men: No Yes  
TV/TS: No Yes  
Others: No Yes  
   
Title:
Comment:
Do you own this image?: No Yes  

Upload Guidelines

  • Do upload
  • Do Not Upload

 

 

 

<?php include("../structure-tagline.php"); ?>  

<?php mysql_free_result($gallmembers); ?> [/php]

First of all I would strongly advise changing to a newer library for interaction with databases
http://www.phphelp.com/forum/the-occasional-tutorial/using-php-with-databases-(pdo-tutorial)/

Secondly it looks strange stopping / restarting php execution all the time, any spesific reason you do this (or is it dreamweaver)?
[php]$totalRows_gallmembers = mysql_num_rows($gallmembers);
//END OF RECORDSET
?><?php
// Smart Image Processor PHP 2.1.1
if (isset($_GET[‘GP_upload’])) {[/php]

And on topic. Seems like $_GET[‘GP_upload’] is not set, it’s the only condition for running the file-save-thing

Aha - thankyou thats sorted it :smiley:

And yes the stopping and starting is a dreamweaver thing - I think it helps the program to identify the individual functions.

Many thanks, it really is appreciated.

Sponsor our Newsletter | Privacy Policy | Terms of Service