问题
Is there any way to rename the
data:image/webp;base64,base64_encode($thumbnail)
to
$IndPackProductImagesArray[0]
so that when someone right clicks to open in a new tab, there's a name instead of encoded text
Below is the code:
<?php
$image = new Imagick();
$image->readImage("images/industrial_packaging/".$IndPackProductImageDirName2."/".$IndPackProductImagesArray[0]);
$watermark = new Imagick();
$watermark->readImage("images/default_products_image_fg.webp");
$image->compositeImage($watermark, Imagick::COMPOSITE_DEFAULT, 0, 0);
$image->thumbnailImage(500, 500, true, true);
header("Content-Type: image/" . $image->getImageFormat());
ob_start();
$thumbnail = $image->getImageBlob();
ob_get_contents();
ob_end_clean();
echo
"
<img
class=\"card-img-top\"
src=\"data:image/webp;base64,".base64_encode($thumbnail)."\"
style=\"background-image: url('images/default_products_image_bg.webp'); background-size:cover;\"
/>
";
?>
Any help appreciated!
来源:https://stackoverflow.com/questions/61419943/renaming-a-dataimage-webpbase64-file-in-php-imagick