N!ck
01-20-2003, 04:18 AM
this generates a blank page when i access it without a query string even...anyone know why?
<?php
require("../forums/global.php");
if ($action=="upload") {
if ($folderid=="") {
eval("standarderror(\"".gettemplate("error_gallery_nofolder")."\");");
exit;
}
if ($caption=="") {
eval("standarderror(\"".gettemplate("error_gallery_nocaption")."\");");
exit;
}
if ($picfile=="") {
eval("standarderror(\"".gettemplate("error_gallery_nopic")."\");");
exit;
}
$picsize=getimagesize($_FILES['picfile']['tmp_name']);
if ($picsize[0]<200) {
eval("standarderror(\"".gettemplate("error_gallery_pictoosmall")."\");");
exit;
}
if (!eregi("jpeg",$_FILES['picfile']['type'])) {
eval("standarderror(\"".gettemplate("error_gallery_invalidtype")."\");");
exit;
}
$securitycheck=$DB_site->query_first("SELECT * FROM galfolder WHERE galfolderid='$folder'");
if ($securitycheck['userid']!=$bbuserinfo['userid']) exit;
$DB_site->query("INSERT INTO galphoto (galphotoid,galfolderid,caption,dateline) VALUES ('0','$folder','$caption','".time()."'");
$pictureid=$DB_site->insert_id();
if ($picsize[0]>500) {
$aspectratio=$picsize[0]/500;
$newwidth=500;
$newheight=round($aspectratio*$picsize[1]);
} else {
$newwidth=$picsize[0];
$newheight=$picsize[1];
}
$srcimg=imagecreatefromjpeg($_FILES['picfile']['tmp_name']);
$dstimg=imagecreatetruecolor($newwidth,$newheight) ;
imagecopyresampled($dstimg,$srcimg,0,0,0,0,$newwid th,$newheight,$picsize[0],$picsize[1]);
$color=imagecolorallocate($dstimg,0,0,100);
$fontx=$newwidth-100;
$fonty=$newheight-6;
imagettftext($dstimg,14,0,$fontx,$fonty,$color,"../images/fonts/serpentine.ttf","V-Driveboat.com");
imagejpeg($dstimg,"../images/gallery/photos/".$pictureid.".jpg","100");
imagedestroy($dstimg);
$naspectratio=80/$picsize[0];
$newheight=round($naspectratio*$picsize[1]);
$thmimg=imagecreatetruecolor(80,$nheight);
imagecopyresampled($thmimg,$srcimg,0,0,0,0,80,$nhe ight,$picsize[0],$picsize[1]);
imagejpeg($thmimg,"../images/gallery/thumbs/".$pictureid.".jpg","100");
imagedestroy($thmimg);
imagedestroy($srcimg);
eval("dooutput(\"".gettemplate("gallery_uploaddone")."\");");
exit;
}
eval("dooutput(\"".gettemplate("gallery_upload")."\");");
?>
<?php
require("../forums/global.php");
if ($action=="upload") {
if ($folderid=="") {
eval("standarderror(\"".gettemplate("error_gallery_nofolder")."\");");
exit;
}
if ($caption=="") {
eval("standarderror(\"".gettemplate("error_gallery_nocaption")."\");");
exit;
}
if ($picfile=="") {
eval("standarderror(\"".gettemplate("error_gallery_nopic")."\");");
exit;
}
$picsize=getimagesize($_FILES['picfile']['tmp_name']);
if ($picsize[0]<200) {
eval("standarderror(\"".gettemplate("error_gallery_pictoosmall")."\");");
exit;
}
if (!eregi("jpeg",$_FILES['picfile']['type'])) {
eval("standarderror(\"".gettemplate("error_gallery_invalidtype")."\");");
exit;
}
$securitycheck=$DB_site->query_first("SELECT * FROM galfolder WHERE galfolderid='$folder'");
if ($securitycheck['userid']!=$bbuserinfo['userid']) exit;
$DB_site->query("INSERT INTO galphoto (galphotoid,galfolderid,caption,dateline) VALUES ('0','$folder','$caption','".time()."'");
$pictureid=$DB_site->insert_id();
if ($picsize[0]>500) {
$aspectratio=$picsize[0]/500;
$newwidth=500;
$newheight=round($aspectratio*$picsize[1]);
} else {
$newwidth=$picsize[0];
$newheight=$picsize[1];
}
$srcimg=imagecreatefromjpeg($_FILES['picfile']['tmp_name']);
$dstimg=imagecreatetruecolor($newwidth,$newheight) ;
imagecopyresampled($dstimg,$srcimg,0,0,0,0,$newwid th,$newheight,$picsize[0],$picsize[1]);
$color=imagecolorallocate($dstimg,0,0,100);
$fontx=$newwidth-100;
$fonty=$newheight-6;
imagettftext($dstimg,14,0,$fontx,$fonty,$color,"../images/fonts/serpentine.ttf","V-Driveboat.com");
imagejpeg($dstimg,"../images/gallery/photos/".$pictureid.".jpg","100");
imagedestroy($dstimg);
$naspectratio=80/$picsize[0];
$newheight=round($naspectratio*$picsize[1]);
$thmimg=imagecreatetruecolor(80,$nheight);
imagecopyresampled($thmimg,$srcimg,0,0,0,0,80,$nhe ight,$picsize[0],$picsize[1]);
imagejpeg($thmimg,"../images/gallery/thumbs/".$pictureid.".jpg","100");
imagedestroy($thmimg);
imagedestroy($srcimg);
eval("dooutput(\"".gettemplate("gallery_uploaddone")."\");");
exit;
}
eval("dooutput(\"".gettemplate("gallery_upload")."\");");
?>