0

How do I get a HTTP_RAW_POST_DATA and can resize to create a smaller image. With the image saved to disk I have classes that does this, more to get HTTP_RAW_POST_DATA I do not know how to do

    if ( isset ( $GLOBALS["HTTP_RAW_POST_DATA"] )) 
{
    //the image file name   
    $fileName =  $_GET['nome'].".jpg";

    // get the binary stream
    $im = $GLOBALS["HTTP_RAW_POST_DATA"];

    //write it
    $fp = fopen('saves/print/'.$fileName, 'wb');
    fwrite($fp, $im);
    fclose($fp);

}
Rene
  • 141
  • 1
  • 10

1 Answers1

0

If the image is coming from a multipart HTML form, then I don't think you can use the raw post data at all...I will likely be empty if I recall my attempts to read it previously.

Instead, you should use move_uploaded_file

Then, resize the image via ImageMagick or GD:

resize image in PHP

Community
  • 1
  • 1
Kevin Nelson
  • 7,156
  • 4
  • 29
  • 39