PHP temporary file upload not valid Image resource

前端 未结 1 722
悲&欢浪女
悲&欢浪女 2020-12-21 19:44

Hi I have a class for resizing images (resizeManager.php):

        Class ResizeManager
    {
        // *** Class variables
        private $image;
        p         


        
相关标签:
1条回答
  • 2020-12-21 20:15

    Test Below Example :

    <form method="post" enctype="multipart/form-data" action="">
    <input type="file" name="file" />
    <div class="td" style="width: 100%; text-align: left;"><button type="submit">OK</button></div>
    </form>
    <?php
    if( isset( $_FILES['file'] ) )
    {
        $img = file_get_contents( $_FILES['file']['tmp_name'] );
        $image = imagecreatefromstring( $img );
        echo imagesx( $image );
    }
    ?> 
    
    0 讨论(0)
提交回复
热议问题