在将文件保存到新文件之前,如何从调整大小的文件中获取 md5?
我正在调整 jpg 的大小,之后我想从中获取 md5,然后使用该 MD5 名称保存新图像。 代码如下所示:
$extension = 'jpg';
$img = imagecreatefromjpeg($source);
$tmp_img = imagecreatetruecolor($newWidth, $newHeight);
imagecopyresampled($tmp_img, $img, 0, 0, 0, 0, $newWidth, $newHeight, $plik[0], $plik[1]);
//$md5 - here i need to get md5...
imagejpeg($tmp_img, $md5.;'.'.$extension);
imagedestroy($img);
是否可以不先保存该 tmp 文件?
I'm doing resize on jpg, after that i would like to get md5 from it and then save new image with that MD5 name.
Code looks like that:
$extension = 'jpg';
$img = imagecreatefromjpeg($source);
$tmp_img = imagecreatetruecolor($newWidth, $newHeight);
imagecopyresampled($tmp_img, $img, 0, 0, 0, 0, $newWidth, $newHeight, $plik[0], $plik[1]);
//$md5 - here i need to get md5...
imagejpeg($tmp_img, $md5.;'.'.$extension);
imagedestroy($img);
Is it possible without saving that tmp file first?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你能在顶部做吗...
我还看到了一种技术,可以将图像文件流式传输到输出缓冲区并捕获它。
然后您可以使用以下命令创建文件...
Can you do at the top...
I've also seen a technique where you stream the image file into an output buffer and capture that.
You could then create your file with...