1

How to put content in png image with height and width i mean i am using php function file_put_contents.I need when this file save than this Png image height and width should be 200px.Check down my code what i have done.

PHP

<?php
     $fname = "orderimages/firstName[".$_POST['getfirstname']."]";
     $finalfilef =$fname."/front_side.png";
     if((isset($_POST['frontval'])) && (isset($_POST['getfirstname']))){
     if(!is_dir($fname)){
         mkdir($fname, 0777 ,true);
      }
         $filteredDataf=substr($_POST['frontval'], strpos($_POST['frontval'], ",")+1);
         //Decode the string
         $unencodedDataf=base64_decode($filteredDataf);
         file_put_contents($finalfilef, $unencodedDataf);
     }

      else {}
?>
M Khalid Junaid
  • 60,231
  • 8
  • 78
  • 110
Affan Ahmad
  • 431
  • 4
  • 8
  • 20
  • possible duplicate of [resize image in PHP](http://stackoverflow.com/questions/14649645/resize-image-in-php) – dave Dec 10 '13 at 20:01
  • http://stackoverflow.com/questions/14649645/resize-image-in-php - Just change `imagecreatefromjpeg($file)` to `imagecreatefrompng($file);` – dave Dec 10 '13 at 20:01
  • Thanks dave for answer but this one not work for me.Can you give me answer with my code.i tried but nothing do anything i mean was't changed size. – Affan Ahmad Dec 10 '13 at 20:19

0 Answers0