blog荒废了好长一段时间,这几天更新到Wordpress 3.0版本,之前的主题也用了三年多,是时候换换,在newwpthemes.com下载了这个名为Estetica的三列版式主题,修改了一下后换上,感觉挺不错的。
更换了新WordPress theme
Posted by 小鹅 on 七月 30th, 2010
在Codeigniter中为上传文件指定名字
Posted by 小鹅 on 十二月 25th, 2008
CI的Upload类不能在上传之前给文件指定名字,在官方论坛找到一个朋友提供的MY_Upload类,该类解决了上传文件不能先指定名字的问题。
使用方法如下:
$config['upload_filename'] = $upload_filename;
$config['upload_path'] = $upload_path;
$config['allowed_types'] = 'jpg|png';
$config['max_size'] = '2000';
$config['max_width'] = '200';
$config['max_height'] = '200';
$this->load->library('upload', $config);
其实就是增加了一个upload_filename字段来做为指定的名字
在Codeigniter中生成png透明缩略图
Posted by 小鹅 on 十二月 15th, 2008
CI中的CI_Image_lib类不能生成背景透明的png或gif缩略图,以下是我的解决办法,重新创建一个MY_Image_lib类,并继承CI_Image_lib类,然后重写一下image_process_gd方法。
先在CI_Image_lib中找到image_process_gd方法,然后把这个方法的全部代码复制到MY_Image_lib类中,然后查找下面这行代码:
$dst_img = $create($this->width, $this->height);
接着在找到的这行代码下面添加如下代码:
$transparent = imagecolortransparent($src_img, imagecolorallocate($src_img, 0, 0, 0));
if ($transparent >= 0) {
imagecolortransparent($dst_img, $transparent);
imagealphablending($dst_img, false);
imagesavealpha($dst_img, true);
}
一个Javascript小游戏
Posted by 小鹅 on 十一月 17th, 2008
刚才在Google Code上闲逛,看到一款Javascript小游戏,可以选择双人对战,或是人和机对战,而且还有回放功能,很有创意 ![]()
查看Pentagoo Code
查看Demo
CSS压缩工具
Posted by 小鹅 on 十月 19th, 2008
CSS Compressor提供3种压缩,Light、Normal、Super Compact,还可以选择是否包涵注释,或去除注释。

CSS Formatter and Optimiser提供5种压缩,自定义选项也很多,压缩时感觉速度也比上面那个要快些

Javascript和PHP的xml to json
Posted by 小鹅 on 七月 18th, 2008
最近在写一个yupoo应用,基于ajax的,所以需要将xml转换为json,在网上搜索后找到两个不错的类
PHP服务端的XMLtoJSON
<?php
require_once("xml2json.php");
echo Xml2json::transformXmlStringToJson(xml_data);
?>
<!-- HTML --> <head> <script type="text/javascript" src="xml2json.js"></script> ... </head>
// Javascript // A simple call - myXML is a string containing your XML: myJsonObject=xml2json.parser(myXML); // A 2:nd, optional, parameter is "tags not to convert" - for example <b> and <i>: myJsonObject=xml2json.parser(myXML,'b,i'); // A 3:rd, optional, parameter gives us a string showing us the JSON structure // instead of the actual JSON object: myString=xml2json.parser(myXML,'','html'); // - use "compact" for output without linebreaks or tabbing // - use "normal" for output with linebreaks and tabbing // - use "html" for a html representation




