Unlinking(deleting) dynamic images

Discussion in 'PHP' started by irx, May 2, 2008.

  1. #1
    Hello
    I am having trouble deleting a user uploaded image after I am done with it. I need to be able to delete the image immediatly off my server as soon as the editing is done.

    heres my code

    
    $Img = ImageCreateFromJPEG($path);
    $cor = imagecolorallocate($Img, 154, 41 ,45);
    imagestring($Img, 2, 580, 550, $name,$cor);
    header('Content-type: image/jpeg');
    imagejpeg($Img, NULL, 100);
    imagedestroy($Img);
    unlink($path);
    
    Code (markup):
    I believe it has something to do with the fact that I am reoutputting the image to browser, and therefore my unlink is useless. Is there a workaround?
     
    irx, May 2, 2008 IP
  2. youscript

    youscript Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    What is the permission of the folder where file under?
    is set to 777?
     
    youscript, May 2, 2008 IP
  3. irx

    irx Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    yes I have set all permissions...
     
    irx, May 3, 2008 IP