Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

286
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda