creating an image in php, display works, saving to file does not

前端 未结 4 1905
一整个雨季
一整个雨季 2020-12-06 05:56

I am creating an image via a php script using imagepng. This works fine and displays well on the website. even saving-as gives me a valid .png file

header( \         


        
4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-06 06:21

    Make sure that PHP has permissions to write files to that folder. chmod probably only affects FTP users or particular users.

    And try one at a time. i.e.:

    header( "Content-type: image/png" );
    imagepng($my_img);
    

    then

    $save = "../sigs/". strtolower($name) .".png";
    imagepng($my_img, $save);
    

    So that you can isolate errors.

    Attempt saving in the same folder as the script first, see if there's any problem.

    $save = strtolower($name) .".png";
    imagepng($my_img, $save);
    

提交回复
热议问题