Perl open local / server image


Reprinted in my blog Garden…


<h2> perl read img </h2>

<img src = "display.html">


display.html It can be rewritten as display.cgi


#! /usr/bin/perl

#Define picture and picture type (can be changed into variable according to requirement)
$image = "1.jpg";
$imgType = 'jpg';

#Open picture
open(IMG, "$image") or die;

#Open with binary
binmode IMG;
binmode STDOUT;

print "Content-type: image/$imgType\n\n";
print while (<IMG>);



Recommended Today

Review of SQL Sever basic command

catalogue preface Installation of virtual machine Commands and operations Basic command syntax Case sensitive SQL keyword and function name Column and Index Names alias Too long to see? Space Database connection Connection of SSMS Connection of command line Database operation establish delete constraint integrity constraint Common constraints NOT NULL UNIQUE PRIMARY KEY FOREIGN KEY DEFAULT […]