Apache/PHP windows 安装设置
2012-04-19 18:19
363 查看
来自hideto
Java里判断Image文件信息格式(GIF/PNG/JPG)/Size/Height/Width?
关键字: Image 格式 大小 宽度 高度1,判断Image格式 用UE打开GIF/PNG/JPG格式的图片文件 我们会发现在文件头部某几个位置的字节的值连起来是'GIF'/'PNG'/'JFIF' 它们的位置分别如下: GIF: 012 JFIF(JPG): 6789 PNG: 123 这样我们可以通过判断这几个字节值来得到Image文件格式: 代码 String type = ""; byte b0 = image.getFileData()[0]; byte b1 = image.getFileData()[1]; byte b2 = image.getFileData()[2]; byte b3 = image.getFileData()[3]; byte b6 = image.getFileData()[6]; byte b7 = image.getFileData()[7]; byte b8 = image.getFileData()[8]; byte b9 = image.getFileData()[9]; // GIF if (b0 == (byte) 'G' && b1 == (byte) 'I' && b2 == (byte) 'F') type = "GIF"; // PNG else if (b1 == (byte) 'P' && b2 == (byte) 'N' && b3 == (byte) 'G') type = "PNG"; // JPG else if (b6 == (byte) 'J' && b7 == (byte) 'F' && b8 == (byte) 'I' && b9 == (byte) 'F') type = "JPG"; else type = "Unknown"; image.setType(type); <script>render_code();</script> 2,判断Image大小 代码 FileImageInputStream fiis = new FileImageInputStream(new File(image.getPath())); image.setSize((float) fii.length() / 1000 + "KB"); <script>render_code();</script> 3,判断Image宽度和高度 代码 ImageIcon ii = new ImageIcon(image.getPath()); image.setHeight(String.valueOf(ii.getIconHeight())); image.setWidth(String.valueOf(ii.getIconWidth())); <script>render_code();</script> |
相关文章推荐
- Apache + PHP + MySql windows xp 安装设置
- Apache+php+mysql在windows下的安装与配置图解
- PHP环境搭建:Windows 7下安装配置PHP+Apache+Mysql环境教程
- windows下安装apache、php、sql server
- windows安装PHP5.4.13 +Apache2.4.4
- windows安装apache/php
- PHP环境搭建:Windows 7下安装配置PHP+Apache+Mysql环境教程
- Windows 平台 Apache php 安装笔记
- wamp环境单独安装(windows下apache2.4、mysql5.5、php5.5的版本)
- Apache+php+mysql在windows下的安装与配置图解(较老版本)
- Windows下PHP 5.6+Apache 2.4+MySQL 5.5安装与配置
- Apache+php+mysql在windows下的安装与配置图解
- Windows下PHP安装路径配置错误导致Apache无法启动的解决方法
- WAMP(Windows Apache MySQL PHP)安装
- PHP + Apache + Windows的设置
- Apache+php+mysql在windows下的安装与配置图解
- Apache+php+mysql在windows下的安装与配置图解(最新版)
- 整合Windows 2000 + j2sdk(还要安装NetBeans或 eclipse及其配置) + apache2 + php-4.3.10 + mysql + Tomcat 4 + jk2(整合APACHE和TOMCAT)
- PHP 5 在 Windows下 的 APACHE 模块化安装 和 MySQL 配置
- Apache+php+mysql在windows下的安装与配置图解之mysql篇