firegate666/imageuploader

支持图像上传和标签中base64编码图像的实用工具

2.0.0 2020-08-06 21:53 UTC

This package is not auto-updated.

Last update: 2024-09-14 18:04:18 UTC


README

打印base 64编码的img标签

上传图像文件并将其作为base64编码的图像打印

HTML

<form method="post" enctype="multipart/form-data">
    <input type="file" name="uploaded_image" />
</form>

PHP

$uploader = new ImageUploader($_FILES);
$base_64_encoded = $uploader->getBase64EncodedImageData('uploaded_image');
$width = $uploader->getWidth('uploaded_image');
$height = $uploader->getHeight('uploaded_image');

print '<img src="' . $base_64_encoded . '" width=" . $width . " height=" . $height . " />'