PhpSpreadSheet Javascript AJAX jQuery PHP Example MORE

How to insert image in PHP excel PhpSpreadsheet

    <?php
    require 'vendor/autoload.php';

    use PhpOffice\PhpSpreadsheet\Spreadsheet;
    use PhpOffice\PhpSpreadsheet\Writer\Xlsx;

    $spreadsheet = new Spreadsheet();
    $sheet = $spreadsheet->getActiveSheet();

    $drawing = new \PhpOffice\PhpSpreadsheet\Worksheet\Drawing();
    $drawing->setName('Paid');
    $drawing->setDescription('Paid');
    $drawing->setPath('images/Yashika.jpg'); /* put your path and image here */
    $drawing->setCoordinates('A1');
    $drawing->setOffsetX(110);
    $drawing->setRotation(25);
    $drawing->getShadow()->setVisible(true);
    $drawing->getShadow()->setDirection(45);
    $drawing->setWorksheet($spreadsheet->getActiveSheet());

    $writer = new Xlsx($spreadsheet);
    $writer->save('image.xlsx');