XPressME Integration Kit

Trac

source: module_icon.php @ 828

Last change on this file since 828 was 828, checked in by toemon, 16 years ago

取り敢えずインストールと表示が出来るようにした初期バージョン

File size: 957 bytes
Line 
1<?php
2$mydirpath = dirname(__FILE__);
3$mydirname = basename($mydirpath);
4$icon_cache_limit = 3600 ; // default 3600sec == 1hour
5
6session_cache_limiter('public');
7header("Expires: ".date('r',intval(time()/$icon_cache_limit)*$icon_cache_limit+$icon_cache_limit));
8header("Cache-Control: public, max-age=$icon_cache_limit");
9header("Last-Modified: ".date('r',intval(time()/$icon_cache_limit)*$icon_cache_limit));
10header("Content-type: image/png");
11
12$icon_fullpath = $mydirpath.'/module_icon.png' ;
13
14if(function_exists( 'imagecreatefrompng' ) && function_exists( 'imagecolorallocate' ) && function_exists( 'imagestring' ) && function_exists( 'imagepng' ) ) {
15
16        $im = imagecreatefrompng( $icon_fullpath ) ;
17
18        $color = imagecolorallocate( $im , 0 , 0 , 0 ) ; // black
19        $px = ( 92 - 6 * strlen( $mydirname ) ) / 2 ;
20        imagestring( $im , 3 , $px , 34 , $mydirname , $color ) ;
21        imagepng( $im ) ;
22        imagedestroy( $im ) ;
23
24} else {
25
26        readfile( $icon_fullpath ) ;
27
28}
29
30?>
Note: See TracBrowser for help on using the repository browser.