Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

283
Views
Saving images uploaded using ImagesLoader

I am trying to wire up the ImagesLoader plugin, which allows uploading multiple images. It has a nice drag-n-drop UI but I just can't figure out how to get the images that were uploaded. I cannot find any documentation.

Link to the plugin page: ImagesLoader

Here is the javascript from the demo:

  <script type="text/javascript">

// Ready
$(document).ready(function () {

  // Create image loader plugin
  var imagesloader = $('[data-type=imagesloader]').imagesloader({
    minSelect: 3
   ,imagesToLoad: [{"Url":"./img/Nespresso001.jpg","Name":"Nespresso001"},{"Url":"./img/Nespresso002.jpg","Name":"Nespresso002"}]
  });

  //Form
  $frm = $('#frm');

  // Form submit
  $frm.submit(function (e) {

    var $form = $(this);

    var files = imagesloader.data('format.imagesloader').AttachmentArray;
    var il = imagesloader.data('format.imagesloader');

    if (il.CheckValidity())
      alert('Upload ' + files.length + ' files');        

    e.preventDefault();
    e.stopPropagation();
  });

});

The images are saved in the object "files". Here is a screen shot of the contents from the inspector:

Inspector

I tried converting to json and posting, but that only generates an error.

            $.ajax({
                url: 'process-images.php',
                type: 'POST',
                data: JSON.stringify(files),
                contentType: 'application/json; charset=utf-8',
                dataType: 'json',
                cache: false,
                error: function() {alert("ERROR");},
                success: function() {alert("OK");}
            });

The rest of the code works just like the demo. Looks like everything needed for the uploaded images is stored in "files". I just need to get the data back to php and I can pull it apart from there. But right now, the original submit code just dies or my addition aborts with an error.

THANKS!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I hope it is not too late to answer. You just need to loop through the base64 encoded image object, decoding and saving each image to the disk.

// Sample code    
foreach(json_decode($request->input('files')) as $file) {
   $name = $file->FileName 
   $imagePath = storage_path('app/public/images/');
   file_put_contents($imagePath.$name, base64_decode($file->Base64));
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!