欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

一键生成各种尺寸Icon的php脚本

程序员文章站 2022-05-04 14:38:10
...
 array 
	(
		array("width" => 180, 	"height"=> 180, 	"path"=>"ios8", 		"name"=>"Icon-180.png"),
		array("width" => 120, 	"height"=> 120, 	"path"=>"ios8", 		"name"=>"Icon-120.png"),
		array("width" => 152, 	"height"=> 152, 	"path"=>"ios8", 		"name"=>"Icon-152.png"),
		array("width" => 76, 	"height"=> 76, 		"path"=>"ios8", 		"name"=>"Icon-76.png"),	
		array("width" => 144, 	"height"=> 144, 	"path"=>"ios8", 		"name"=>"Icon-144.png"),
		array("width" => 72, 	"height"=> 72, 		"path"=>"ios8", 		"name"=>"Icon-72.png"),
		array("width" => 114, 	"height"=> 114, 	"path"=>"ios8", 		"name"=>"Icon-114.png"),
		array("width" => 57, 	"height"=> 57, 		"path"=>"ios8", 		"name"=>"Icon-57.png"),	
		array("width" => 100, 	"height"=> 100, 	"path"=>"ios8", 		"name"=>"Icon-100.png"),
		array("width" => 50, 	"height"=> 50, 		"path"=>"ios8", 		"name"=>"Icon-50.png"),	
		array("width" => 80, 	"height"=> 80, 		"path"=>"ios8", 		"name"=>"Icon-80.png"),
		array("width" => 40, 	"height"=> 40, 		"path"=>"ios8", 		"name"=>"Icon-40.png"),
		array("width" => 58, 	"height"=> 58, 		"path"=>"ios8", 		"name"=>"Icon-58.png"),
		array("width" => 29, 	"height"=> 29, 		"path"=>"ios8", 		"name"=>"Icon-29.png"),
	),
	"IOS" => array 
	(
		array("width" => 180, 	"height"=> 180, 	"path"=>"ios", 		"name"=>"Icon-60@3x.png"),
		array("width" => 120, 	"height"=> 120, 	"path"=>"ios", 		"name"=>"Icon-60@2x.png"),
		array("width" => 152, 	"height"=> 152, 	"path"=>"ios", 		"name"=>"Icon-76@2x.png"),
		array("width" => 76, 	"height"=> 76, 		"path"=>"ios", 		"name"=>"Icon-76.png"),	
		array("width" => 144, 	"height"=> 144, 	"path"=>"ios", 		"name"=>"Icon-72@2x.png"),
		array("width" => 72, 	"height"=> 72, 		"path"=>"ios", 		"name"=>"Icon-72.png"),
		array("width" => 114, 	"height"=> 114, 	"path"=>"ios", 		"name"=>"Icon-57@2x.png"),
		array("width" => 57, 	"height"=> 57, 		"path"=>"ios", 		"name"=>"Icon-57.png"),	
		array("width" => 100, 	"height"=> 100, 	"path"=>"ios", 		"name"=>"Icon-50@2x.png"),
		array("width" => 50, 	"height"=> 50, 		"path"=>"ios", 		"name"=>"Icon-50.png"),	
		array("width" => 80, 	"height"=> 80, 		"path"=>"ios", 		"name"=>"Icon-40@2x.png"),
		array("width" => 40, 	"height"=> 40, 		"path"=>"ios", 		"name"=>"Icon-40.png"),
		array("width" => 58, 	"height"=> 58, 		"path"=>"ios", 		"name"=>"Icon-29@2x.png"),
		array("width" => 29, 	"height"=> 29, 		"path"=>"ios", 		"name"=>"Icon-29.png"),
	)
	,
	"ANDROID" => array
	(
		array("width" => 144, 	"height" => 144, 	"path" => "android/drawable", 			"name"=>"icon.png"),
		array("width" => 144, 	"height" => 144, 	"path" => "android/drawable-xhdpi", 	"name"=>"icon.png"),
		array("width" => 72, 	"height" => 72, 	"path" => "android/drawable-hdpi", 		"name"=>"icon.png"),
		array("width" => 48, 	"height" => 48, 	"path" => "android/drawable-mdpi", 		"name"=>"icon.png"),
		array("width" => 32, 	"height" => 32, 	"path" => "android/drawable-ldpi", 		"name"=>"icon.png")
	)
);


foreach ($IconArray["IOS8"] as $key => $IconType) 
{
	thumb("icon.png",$IconType['width'],$IconType['height'],$IconType['path'],$IconType['name']);
}

foreach ($IconArray["IOS"] as $key => $IconType) 
{
	thumb("icon.png",$IconType['width'],$IconType['height'],$IconType['path'],$IconType['name']);
}

foreach ($IconArray["ANDROID"] as $key => $IconType) 
{
	thumb("icon.png",$IconType['width'],$IconType['height'],$IconType['path'],$IconType['name']);
}

?>

使用方法: php IconMaster.php

以上就介绍了 一键生成各种尺寸Icon的php脚本,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。