Reproduced in my blog garden https://www.cnblogs.com/kenso…
index.html
<html>
<body>
<h2> perl read img </h2>
<img src = "display.html">
</body>
</html>
Display.html can be rewritten to Display.cgi
display.html
#! /usr/bin/perl $image = "1.jpg"; /usr/bin/perl $image = "1.jpg"; $imgType = 'jpg'; Open (IMG, "$image") or die; # open binmode IMG with binaries; binmode STDOUT; Print "content-type: image/$imgType\n\n"; print while (<IMG>); close(IMG); exit(0);