Imagecopymerge not working

Discussion in 'PHP' started by midnight123, Sep 25, 2007.

  1. #1
    Hello.I've uploaded a small image which I want to place at a
    specific location into a larger image.The problem is
    the imagecopymerge function doesn't seem to be doing anything.I echoed it and it returned true which indicates
    it is working except it's not doing anything.
    And theres no errors either.
    Once again this doofus is clueless.
    Thank you


    
    <html><body><br><br><br>
    <?php
    $thisimage=$_POST["initimage"];
    echo("<center>");
    echo("<IMG SRC='uploads/$thisimage'>");
     echo("</center>");  
    list($width, $height, $type, $attr) = getimagesize("uploads/".$thisimage);
    
     echo("<br><center>");
      $size=$height * $width;
      echo("Pixal size : ");
      echo($size);
      echo("</center><br>");
    $xpos=$_POST['mpos_x'];
    $ypos=$_POST['mpos_y'];
    echo($xpos);
    echo("<br>");
    echo($ypos);
    
     $image3=ImageCreateFromJpeg('uploads/'.$thisimage);
     $image2=ImageCreateFromJpeg('uploads/grid.jpg');
                imagecopymerge($image2,$image3,$xpos,$ypos,0,0,
    $width,$height,100);           
    echo("<center>");
    echo("<IMG SRC='uploads/grid.jpg'>");
    echo("</center>");
    ?>
    </body></html>
    
    Code (markup):
     
    midnight123, Sep 25, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    You're not actually creating the image.

    
    imagejpeg($image2, 'uploads/grid.jpg');
    
    PHP:
    Add this under imagecopymerge().
     
    nico_swd, Sep 25, 2007 IP
  3. midnight123

    midnight123 Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks.That works.I asumed it would of created the image by default.
    Now I know.Now I have to find another problem.This doofus is going
    for three in a row.
     
    midnight123, Sep 25, 2007 IP