I'm trying to replace an image with replacePlaceholderImage. but the image got stretched and cropped instead of displaying correctly.
this is the code i'm using.
<?php
$docx = new CreateDocxFromTemplate("New_Foto_BA.docx");
$opsi_foto = array(
"width" => 10
);
$opsi_text = array(
"parseLineBreaks"=>true,
);
$data = "{\"type\":\"rear_camera\",\"value\":\"IMG_07092017_213225_PSBVaabhn2.jpg\"}";
if ($data===false)
{
exit(0);
}
$foto = json_decode($data, true);
$docx->replaceVariableByText(array(
"FOTO_BA"=>" ", "KET_TAMBAHAN"=>"Lorem Ipsum dolor sit amet",
), $opsi_text);
$docx->replacePlaceholderImage("FOTO_BA", $foto["value"], $opsi_foto);
$namaFile = "The_Result.docx";
$docx->createDocx( $namaFile );
echo "https://localhost/phpdocx/".$namaFile;
?>