usestrict;
usewarnings;
useData::Dumper;
useImage::Size'imgsize';
useImage::Size'html_imgsize';
useImage::Size'attr_imgsize';
##模块概述:读取图像尺寸。
##输入形式均以流的形式传入。
##该模块可以辨识以下格式图片
# GIF
# JPG
# XBM
# XPM
# PPM系列(PPM / PGM / PBM)
# XV缩略图
# PNG
# MNG
# TIF
# BMP
# PSD(Adobe PhotoShop)
# SWF(ShockWave / Flash)
# CWS(FlashMX,压缩SWF,Flash 6)
# PCD(柯达PhotoCD,见下面的注释)
# EMF(Windows增强型图元文件格式)
# WEBP
# ICO(微软图标格式)
# CUR(微软鼠标光标格式)
#如果Image :: Magick模块存在,则Image::Size也支持他支持的文件类型
##文件路径
my$file_name ="a06526e8-5c69-11e7-a6d1-000c29ccfba6_xxxImg.jpg";
##子程序:imgsize
##返回:按顺序返回图片的宽度和高度。(一共返回三个元素,前两个为宽、高,最后一个参数为图片类型)如果调用失败,则列表中第一个元素将会为undef,第三个元素将返回一个包含描述的错误信息。
my($width,$height) =imgsize($file_name);
print"$width--width\n";
print"$height---hight\n";
#print "$format--type\n";
##子程序:html_imgsize
##返回:返回一个字符串,字符串内容为:'width="X" height="Y",如果调用失败则返回undef。
my$string=html_imgsize($file_name);
printDumper($string);
##子程序:attr_imgsize
##返回:含有四个元素的列表,列表内容大致为:
# [
#'-width',
# 580,
# '-height',
# 378
# ];
##如果调用失败则会返回undef
my@hashInfo =attr_imgsize($file_name);
printDumper(\@hashInfo)."\n";