Code lấy icon java làm mô tả

Chủ Nhật, 14 tháng 7, 2013

Có thể dùng để tạo icon game cạnh link download thêm sinh động. Tạo file java.php rồi pase code này vào:

 


<?php
if(!isset($_GET['jar']))exit;
$zip = new ZipArchive;
if ($zip->open(base64_decode
($_GET['jar'])) === TRUE) {
if($manifest = $zip->getFromName('META-INF/
MANIFEST.MF')){
if (strpos($manifest, 'MIDlet-Icon: ') !== FALSE){
$jad = explode('MIDlet-Icon: ',$manifest);
$icon = str_replace("n",' ', $jad[1]);
$icon = str_replace("r",' ', $icon);
$icon = strtok($icon,' ');
$icon = preg_replace('#/#', NULL, $icon);
}
else $icon='icon.png';
}else exit;
if($image = $zip->getFromName($icon)){
$image = imagecreatefromstrin($image);
$width=imagesx($image);
$height=imagesy($image);
$x_ratio=16/$width;
$y_ratio=16/$height;
if(($width<=16)&&
($height<=16)){
$tn_width=$width;
$tn_height=$height;
}elseif(($x_ratio*$height)<16){
$tn_height=ceil($x_ratio*
$height);
$tn_width=16;
}else{
$tn_width=ceil($y_ratio*$width);
$tn_height=16;
}
$dst=ImageCreate($tn_width,$tn_height);
imagecopyresampled($dst, $image, 0, 0, 0, 0, $tn_widt,$tn_height,$width,$height);
$image = $dst;
}else{
$image = imagecreatefrompng('my_icon.png');
}
header('Content-type: image/
png');
ImagePng($image);
ImageDestroy($image);
$zip->close();
}
?>

cách dùng: chạy link <span style="text-decoration: underline;">java.php?jar=linkgame</span> để lấy link icon

Không có nhận xét nào:

Đăng nhận xét