Hallo, vielleicht kann mir jemand bei meinem Problem helfen. Ich nutze für den Bilder Upload SWF Upload. Die hochgeladenen Bilder sollen auf 650px verkleinert und Thumbs von 120px erstellt werden. Leider werden alle Bilder auf 120 px verkleinert, ich entdecke den Fehler einfach nicht.
ob_start();
imagejpeg($new_img);
$imagevariable = ob_get_contents();
ob_end_clean();
$file_id = md5($_FILES["Filedata"]["tmp_name"] + rand()*100000);
$_SESSION["file_info"][$file_id] = $imagevariable;
$_SESSION["full_image"][$file_id] = $fullimagevariable;
if($tid != ""){
if(!is_dir("../images/gal/".$tid)){
mkdir("../images/gal/".$tid);
chmod("../images/gal/".$tid, 0777);
}
if(!is_dir("../images/gal/".$tid."/thumbs")){
mkdir("../images/gal/".$tid."/thumbs");
chmod("../images/gal/".$tid."/thumbs", 0777);
}
$fp = fopen("../images/gal/".$tid."/thumbs/".$file_id.".jpg", "w+");
fwrite($fp, $_SESSION["file_info"][$file_id]);
fclose($fp);
if(checkwh("../images/gal/".$tid."/thumbs/".$file_id.".jpg")){
$tn = new thumbs(650,650, "../images/gal/".$tid."/thumbs/".$file_id.".jpg", "../images/gal/".$tid."/".$file_id.".jpg");
}else{
file_put_contents("../images/gal/".$tid."/".$file_id.".jpg", $_SESSION["full_image"][$file_id]);
}
mysql_query("INSERT INTO wol_gals SET pic='".$file_id.".jpg', evid='".$evid."', tid='".$tid."', user_id='".$user_id."',user_name='".$user_name."'");
//echo mysql_error();
}
echo "FILEID:" . $file_id; // Return the file id to the script
function checkwh($myimg){
global $file_id, $tid;
$img = @imagecreatefromjpeg($myimg);
$width = imageSX($img);
$height = imageSY($img);
if($width >= 650 || $height >= 650){
return TRUE;
}else{
return FALSE;
}
}
ob_start();
imagejpeg($new_img);
$imagevariable = ob_get_contents();
ob_end_clean();
$file_id = md5($_FILES["Filedata"]["tmp_name"] + rand()*100000);
$_SESSION["file_info"][$file_id] = $imagevariable;
$_SESSION["full_image"][$file_id] = $fullimagevariable;
if($tid != ""){
if(!is_dir("../images/gal/".$tid)){
mkdir("../images/gal/".$tid);
chmod("../images/gal/".$tid, 0777);
}
if(!is_dir("../images/gal/".$tid."/thumbs")){
mkdir("../images/gal/".$tid."/thumbs");
chmod("../images/gal/".$tid."/thumbs", 0777);
}
$fp = fopen("../images/gal/".$tid."/thumbs/".$file_id.".jpg", "w+");
fwrite($fp, $_SESSION["file_info"][$file_id]);
fclose($fp);
if(checkwh("../images/gal/".$tid."/thumbs/".$file_id.".jpg")){
$tn = new thumbs(650,650, "../images/gal/".$tid."/thumbs/".$file_id.".jpg", "../images/gal/".$tid."/".$file_id.".jpg");
}else{
file_put_contents("../images/gal/".$tid."/".$file_id.".jpg", $_SESSION["full_image"][$file_id]);
}
mysql_query("INSERT INTO wol_gals SET pic='".$file_id.".jpg', evid='".$evid."', tid='".$tid."', user_id='".$user_id."',user_name='".$user_name."'");
//echo mysql_error();
}
echo "FILEID:" . $file_id; // Return the file id to the script
function checkwh($myimg){
global $file_id, $tid;
$img = @imagecreatefromjpeg($myimg);
$width = imageSX($img);
$height = imageSY($img);
if($width >= 650 || $height >= 650){
return TRUE;
}else{
return FALSE;
}
}