This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Template.php | |
【前準備】 | |
・Template.php と同階層に template, cache, compile ディレクトリを作成(適切に権限与えとく必要あり) | |
・以下の内容で template/test.tpl を作成 | |
-------------------- | |
aaaの内容は{aaa} | |
bbbの内容は{bbb} | |
-------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* GD+Imagick = morphing | |
* | |
* @param string $fromPath | |
* @param string $toPath | |
* @param string $outPath | |
* @param integer $frame OPTIONAL | |
* @param integer $delay OPTIONAL | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// create animation gif | |
function animate($fileList, $delay, $out){ | |
$img = new Imagick(); | |
$img->setFormat('gif'); | |
foreach($fileList as $file) { | |
$tmp = new Imagick($file); | |
$tmp->setFormat('gif'); | |
$tmp->setImageDelay($delay); | |
$img->addImage($tmp); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// gif transparent check | |
function getGifTp($imgPath) { | |
$sz = getimagesize($imgPath); | |
$x = $sz[0]; | |
$y = $sz[1]; | |
$im = imagecreatefromgif($imgPath); | |
for($sx=0; $sx<$x; $sx++) { | |
for($sy=0; $sy<$y; $sy++) { | |
$rgb = imagecolorat($im, $sx, $sy); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// JPEG 2 ASCII | |
$in = 'test.jpg'; | |
$out = 'test.html'; | |
$buf = ''; | |
$gd = imagecreatefromjpeg($in); | |
$w = imagesx($gd); | |
$h = imagesy($gd); | |
for($y=0; $y<$h; $y++){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Misc_Lib_Myspace class | |
* | |
* myspace url/id ⇒ get mp3/flv video | |
* | |
* [usage_1 set id] | |
* $ms = new Misc_Lib_Myspace(); | |
* $ms->setId('britneyspears'); | |
* $ms->load(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* MobileIp.php | |
* | |
* usage: | |
* require_once 'MobileIp.php'; | |
* print_r( MobileIp::get('all') ); | |
* print_r( MobileIp::get() ); | |
* print_r( MobileIp::get('docomo') ); | |
* print_r( MobileIp::get('au') ); | |
* print_r( MobileIp::get('softbank') ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// クラスを配列にキャストするとどうなるか | |
class Test { | |
private $a = 'private'; | |
public $b = 'public'; | |
} | |
$obj = new Test(); | |
$arr = (array)$obj; | |
echo $arr["\0Test\0a"]; // private |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// テスト | |
set_time_limit(600); | |
$tNum = 92; | |
$base = 'http://pic2ch.giox.org/'; | |
$src = file_get_contents("{$base}thread/{$tNum}"); | |
if ($src === false) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Http class | |
// 日本語UTF-8 | |
class Http | |
{ | |
public static function get($url, $header = null) { | |
$param = array( | |
'http'=>array('method'=>'GET') | |
); | |
if ($header !== null) { |
OlderNewer