Results 1 to 8 of 8

Thread: php edit image

  1. #1
    Join Date
    Aug 2009
    Posts
    74
    Thanks
    7
    Thanked 1 Time in 1 Post

    Default php edit image

    my problem is the following code is not editing my image
    -------------------------------------------------------------------------------------------------

    PHP Code:
    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>
    }
    /* 
    Last edited by keyboard; 04-21-2014 at 10:06 PM. Reason: Format: Php Tags [php][/php]

  2. #2
    Join Date
    Mar 2007
    Location
    New York, NY
    Posts
    557
    Thanks
    8
    Thanked 66 Times in 66 Posts

    Default

    ... and, what exactly do you want this script to edit?
    - Josh

  3. #3
    Join Date
    Aug 2009
    Posts
    74
    Thanks
    7
    Thanked 1 Time in 1 Post

    Default

    to edit image, to upload a new image if required or leave the same first image
    Last edited by hemi; 09-10-2009 at 04:52 AM.

  4. #4
    Join Date
    Mar 2007
    Location
    New York, NY
    Posts
    557
    Thanks
    8
    Thanked 66 Times in 66 Posts

    Default

    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...?
    - Josh

  5. #5
    Join Date
    Aug 2009
    Posts
    74
    Thanks
    7
    Thanked 1 Time in 1 Post

    Default

    anyway there was a funny mistake with the other file.thnks for ur consideration .now i got it correct

  6. #6
    Join Date
    Mar 2007
    Location
    New York, NY
    Posts
    557
    Thanks
    8
    Thanked 66 Times in 66 Posts

    Default

    hehe, alright then.
    - Josh

  7. #7
    Join Date
    Apr 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post I need your help i can ..

    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 ....

  8. #8
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    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.
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •