506629361 发表于 2017-3-28 11:47:36

php image 转 data uri 图片 (Image Data URIs with PHP)

<?php
function getDataURI($image, $mime = '') {
return 'data: '.($mime ? (function_exists('mime_content_type') ? mime_content_type($image) : $mime) : '').';base64,'.base64_encode(file_get_contents($image));
}
  view demo
  原文:http://davidwalsh.name/data-uri-php
页: [1]
查看完整版本: php image 转 data uri 图片 (Image Data URIs with PHP)