Hi frnds...
here i am confusing a lot..lot...from last 4 days i am struggling here...plz solve this problem aeap with patience....
This is my code for uploading images to my folder and db table...now, all images are blur at my user side...so, i need to create THUMBNAIL images for every image...plz change my code and write code for thumbmail creation..explain it breifly....
<?php
ob_start();
session_start();
include("config.inc.php");
$gcategory=mysql_real_escape_string($_POST['gcategory']);
$gname=mysql_real_escape_string($_POST['gname']);
$date=date('y-m-d');
foreach ($_FILES["attachments4"]["tmp_name"] as $key => $error)
{
if ($error == UPLOAD_ERR_OK)
{
@$tmp_name0 = $_FILES["attachments4"]["tmp_name"][0];
@$name0 = $_FILES["attachments4"]["name"][0];
@$tmp_name1 = $_FILES["attachments4"]["tmp_name"][1];
@$name1 = $_FILES["attachments4"]["name"][1];
@$tmp_name2 = $_FILES["attachments4"]["tmp_name"][2];
@$name2 = $_FILES["attachments4"]["name"][2];
@$tmp_name3 = $_FILES["attachments4"]["tmp_name"][3];
@$name3 = $_FILES["attachments4"]["name"][3];
@$tmp_name4 = $_FILES["attachments4"]["tmp_name"][4];
@$name4 = $_FILES["attachments4"]["name"][4];
@$tmp_name5 = $_FILES["attachments4"]["tmp_name"][5];
@$name5 = $_FILES["attachments4"]["name"][5];
@$tmp_name6 = $_FILES["attachments4"]["tmp_name"][6];
@$name6 = $_FILES["attachments4"]["name"][6];
@$tmp_name7 = $_FILES["attachments4"]["tmp_name"][7];
@$name7 = $_FILES["attachments4"]["name"][7];
@$tmp_name8 = $_FILES["attachments4"]["tmp_name"][8];
@$name8 = $_FILES["attachments4"]["name"][8];
@$tmp_name9 = $_FILES["attachments4"]["tmp_name"][9];
@$name9 = $_FILES["attachments4"]["name"][9];
$title1="../../gallery/allgallerys/$gcategory/$gname";
@move_uploaded_file($tmp_name0, "$title1"."/"."$name0");
@move_uploaded_file($tmp_name1, "$title1"."/"."$name1");
@move_uploaded_file($tmp_name2, "$title1"."/"."$name2");
@move_uploaded_file($tmp_name3, "$title1"."/"."$name3");
@move_uploaded_file($tmp_name4, "$title1"."/"."$name4");
@move_uploaded_file($tmp_name5, "$title1"."/"."$name5");
@move_uploaded_file($tmp_name6, "$title1"."/"."$name6");
@move_uploaded_file($tmp_name7, "$title1"."/"."$name7");
@move_uploaded_file($tmp_name8, "$title1"."/"."$name8");
@move_uploaded_file($tmp_name9, "$title1"."/"."$name9");
}
}
$sql="select id from gallerymain where gcategory='$gcategory' and gname='$gname'";
$res=mysql_query($sql)or die(mysql_error());
while($row=mysql_fetch_array($res)){
$gid=$row['id'];
}
$title="allgallerys/$gcategory/$gname";
if($name0!='')
{
$path="$title"."/"."$name0";
$sql="insert into galleryphotos values('','$gid','$path','$date')";
mysql_query($sql)or die(mysql_error());
}
if($name1!='')
{
$path="$title"."/"."$name1";
$sql="insert into galleryphotos values('','$gid','$path','$date')";
mysql_query($sql)or die(mysql_error());
}
if($name2!='')
{
$path="$title"."/"."$name2";
$sql="insert into galleryphotos values('','$gid','$path','$date')";
mysql_query($sql)or die(mysql_error());
}
if($name3!='')
{
$path="$title"."/"."$name3";
$sql="insert into galleryphotos values('','$gid','$path','$date')";
mysql_query($sql)or die(mysql_error());
}
if($name4!='')
{
$path="$title"."/"."$name4";
$sql="insert into galleryphotos values('','$gid','$path','$date')";
mysql_query($sql)or die(mysql_error());
}
if($name5!='')
{
$path="$title"."/"."$name5";
$sql="insert into galleryphotos values('','$gid','$path','$date')";
mysql_query($sql)or die(mysql_error());
}
if($name6!='')
{
$path="$title"."/"."$name6";
$sql="insert into galleryphotos values('','$gid','$path','$date')";
mysql_query($sql)or die(mysql_error());
}
if($name7!='')
{
$path="$title"."/"."$name7";
$sql="insert into galleryphotos values('','$gid','$path','$date')";
mysql_query($sql)or die(mysql_error());
}
if($name8!='')
{
$path="$title"."/"."$name8";
$sql="insert into galleryphotos values('','$gid','$path','$date')";
mysql_query($sql)or die(mysql_error());
}
if($name9!='')
{
$path="$title"."/"."$name9";
$sql="insert into galleryphotos values('','$gid','$path','$date')";
mysql_query($sql)or die(mysql_error());
}
//header('Location : uploadgallery.php');
?>
Thanks in advance....