Pngquant 有以下 php 示例
// '-' makes it use stdout, required to save to $compressed_png_content variable
// '<' makes it read from the given file path
// escapeshellarg() makes this safe to use with any path
$compressed_png_content = shell_exec("pngquant --quality=$min_quality-$max_quality - < ".escapeshellarg( $path_to_png_file));
我想$path_of_file
用实际内容替换。
这将避免在将文件从一种格式转换为 png 并对其进行优化时浪费 I/O
在那种情况下新的shell_exec()
命令是什么