Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>AFAIK, You have to use image function imagecreatefromstring, imagejpeg to create the images.</p> <pre><code>$imageData = base64_decode($imageData); $source = imagecreatefromstring($imageData); $rotate = imagerotate($source, $angle, 0); // if want to rotate the image $imageSave = imagejpeg($rotate,$imageName,100); imagedestroy($source); </code></pre> <p>Hope this will help.</p> <p><code>PHP CODE WITH IMAGE DATA</code></p> <pre><code>$imageDataEncoded = base64_encode(file_get_contents('sample.png')); $imageData = base64_decode($imageDataEncoded); $source = imagecreatefromstring($imageData); $angle = 90; $rotate = imagerotate($source, $angle, 0); // if want to rotate the image $imageName = "hello1.png"; $imageSave = imagejpeg($rotate,$imageName,100); imagedestroy($source); </code></pre> <p>So Following is the php part of your program .. <code>NOTE</code> the change with comment <code>Change is here</code></p> <pre><code> $uploadedPhotos = array('photo_1','photo_2','photo_3','photo_4'); foreach ($uploadedPhotos as $file) { if($this-&gt;input-&gt;post($file)){ $imageData = base64_decode($this-&gt;input-&gt;post($file)); // &lt;-- **Change is here for variable name only** $photo = imagecreatefromstring($imageData); // &lt;-- **Change is here** /* Set name of the photo for show in the form */ $this-&gt;session-&gt;set_userdata('upload_'.$file,'ant'); /*set time of the upload*/ if(!$this-&gt;session-&gt;userdata('uploading_on_datetime')){ $this-&gt;session-&gt;set_userdata('uploading_on_datetime',time()); } $datetime_upload = $this-&gt;session-&gt;userdata('uploading_on_datetime',true); /* create temp dir with time and user id */ $new_dir = 'temp/user_'.$this-&gt;session-&gt;userdata('user_id',true).'_on_'.$datetime_upload.'/'; if(!is_dir($new_dir)){ @mkdir($new_dir); } /* move uploaded file with new name */ // @file_put_contents( $new_dir.$file.'.jpg',imagejpeg($photo)); imagejpeg($photo,$new_dir.$file.'.jpg',100); // &lt;-- **Change is here** } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload