Export images shown in DataTables (excel)

Export images shown in DataTables (excel)

TronikTronik Posts: 122Questions: 28Answers: 1

Hi,

I've googled and searched these forums and I saw the existing threads about this. They provided some guidance on how to achieve this, and as far as I can tell is not a very easy thing to do.
I just wanted to see if anyone has managed to do this, or if there are any other updates on the subject.

My case as a little different since Im pulling image from an FTP, dont know if that makes it easier or harder.

{ data: 'Extra9', "render": function (  data, type, full, meta ) {
        
          if(data)
            return '<img height="25" class="zoom" src="getimage.php?img_src='+data+'"/>';
          else
                return "";
                
            }
        }

Using the html5 extend excel button for export.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,602Questions: 1Answers: 10,486 Site admin
    Answer ✓

    My case as a little different since Im pulling image from an FTP, dont know if that makes it easier or harder.

    That's certainly going to make it harder! Indeed, I saw something the other day about Google removing FTP support from Chrome, so you might want to be a little careful here.

    Its already really rather difficult to get images into the Excel file - I'm afraid its not something I've looked into and I don't recall any members of the community having posted any examples about that.

    I suspect what you would need to do is research how image files are embedded and then referenced in a Open Spreadsheet doc. The easiest way (and how I did a lot of the Buttons Excel export) was to create an example Excel file, unzip it and inspect the XML / file structure it creates.

    Allan

  • TronikTronik Posts: 122Questions: 28Answers: 1

    The image is loaded from a php script so I dont think that will be an issue

    header('Content-Type: image/jpeg');
    
    $img = $_GET['img_src'];
    
    echo file_get_contents($img);
    

    I will do some digging into the OpenXML documentation, let you know if I find anything.

    Thanks allan

This discussion has been closed.