Log in

View Full Version : php edit image



hemi
09-09-2009, 09:53 AM
my problem is the following code is not editing my image
-------------------------------------------------------------------------------------------------


if($_REQUEST['id'])
{
if($file=="")
{
$vars='uploads/';

$file=$vars.basename($_FILES['images']['name']);
move_uploaded_file($_FILES['images']['tmp_name'],$file);
}
$result=mysql_query("select * from category where id=$_REQUEST[id]");
if($result)
if(mysql_num_rows($result))
extract(mysql_fetch_assoc($result),EXTR_PREFIX_ALL ,'msg');
if($images=="")
{
$file=$msg_images;
}
$vars='uploads/';
$result=mysql_query("select * from category where id='$_REQUEST[id]'");
if($result)
if(mysql_num_rows($result))
$var=mysql_fetch_array($result);
if(isset($_POST['submit']))
{
$title=$_POST['title'];
$rupees=$_POST['rupees'];
$location=$_POST['location'];

$description=$_POST['description'];
$email=$_POST['email'];
//echo"update category set title='$title',rupees='$rupees',images='$file',loc ation='$location',email='$email',description='$des cription' where id={$_REQUEST['id']}";
$result=mysql_query("update category set title='$title',rupees='$rupees',location='$locatio n',email='$email',description='$description' where id={$_REQUEST['id']}");
if($result)
{

//echo"SELECT id FROM category where email='$email'& title='$title'& rupees='$rupees' & location='$location' & desrciption='$description'";
$res=mysql_query("SELECT id FROM category where id=$_REQUEST[id]");
$var=mysql_fetch_array($res);
header("Location:sale2.php?id=$var[id]");

}
else
{
echo "problem";
}

}

}
$resu=mysql_query("select * from category where id='$_REQUEST[id]'");
if($resu)
if(mysql_num_rows($resu))

$v=mysql_fetch_array($resu);

$titl=$v['title'];

$locatio=$v['location'];
$rupe=$v['rupees'];
$descriptio=$v['description'];
$emai=$v['email'];
$hob=$v['hobbies'];
$img=$v['images'];
$imgg=$v['image'];
show_form($titl,$locatio,$descriptio,$rupe,$emai,$ img,$imgg);
function show_form($titl,$locatio,$descriptio,$rupe,$emai,$ img,$imgg)
{



echo"

<form method='POST' action='editsale.php' name='form1' enctype='multipart/form-data' >




<tr> <td> <table align=center border=1 bgcolor=F7F5F4 height=200 width=100%>




<tr><td> Posting Title
<input type='text' name=title value='$titl' size='30' maxlength='70'>

PRICE (INR)
<input type='text' name='rupees' value='$rupe' size='10' maxlength='70'>

Specific Location
<input type='text' name='location' value='$locatio' size='30' maxlength='70'></td></tr>

<div class='row'>
<br>
<tr><td> <div><span class='req'>Reply to: </span></div>

<div>
<input style='color: rgb(170, 170, 170);' tabindex='1' class='req df' id='FromEMail' name='email' size='30' value='$emai' maxlength='60' type='text'>

<br>

<br> </div>

</div>

<br clear='all'>

</td></tr>


<tr><td> Post description <br>
<textarea name='description' cols=140 rows=10 value='$descriptio'>$descriptio</textarea></td></tr>

<input type ='hidden'name='id' value='$_REQUEST[id]'>
<tr><td> <input type='submit' name='submit' value='update' ></td></tr></table>";


<tr><td>upload: <input type='file' name='images' value=''>






<img src='$img' width=70 height=70></td></tr>

<tr><td>upload: <input type='file' name='image' value='$var[image]' >






<img src='$imgg' width=70 height=70></td></tr>
}
/*

JShor
09-09-2009, 03:02 PM
... and, what exactly do you want this script to edit?

hemi
09-10-2009, 04:44 AM
to edit image, to upload a new image if required or leave the same first image

JShor
09-10-2009, 05:36 AM
Sorry, you'll need to be more specific. What is the purpose of the script? What is it checking the image for? It's dimensions? If it already exists? It's extension, filesize, etc...?

hemi
09-10-2009, 10:42 AM
anyway there was a funny mistake with the other file.thnks for ur consideration .now i got it correct

JShor
09-10-2009, 04:17 PM
hehe, alright then.:)

sobhas khan
04-21-2014, 07:44 PM
i am developing an application in php i tried my best but was not able to make an image editable using php ..i want your code to "edit an image in php ...if you r willing then do inform kindly ....

Beverleyh
04-21-2014, 07:55 PM
This is a very old thread and the participants are sadly no longer active members of the DD forum. Please start a new thread for your question and clearly state what it is that you are trying to achieve (in what way are you hoping to edit the image?), with any code you have tried already. You can link to this thread if you need to.