更换了新WordPress theme

blog荒废了好长一段时间,这几天更新到Wordpress 3.0版本,之前的主题也用了三年多,是时候换换,在newwpthemes.com下载了这个名为Estetica的三列版式主题,修改了一下后换上,感觉挺不错的。 :roll:

WCG粤东赛区第一场胜利


基mo的渔人,教练的兽王,小羊的冰女,馒头的幻影长矛手,还有我的痛苦女王,轻松的拿下对手 ;-)

在Codeigniter中为上传文件指定名字

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字段来做为指定的名字 :razz:

在Codeigniter中生成png透明缩略图

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小游戏

刚才在Google Code上闲逛,看到一款Javascript小游戏,可以选择双人对战,或是人和机对战,而且还有回放功能,很有创意 :cool:
查看Pentagoo Code
查看Demo

CSS压缩工具

CSS Compressor提供3种压缩,LightNormalSuper Compact,还可以选择是否包涵注释,或去除注释。

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

unitpngfix.js

unitpngfix.js是一个能让IE6正常显示PNG透明背景图片的脚本

UvumiTools Dropdown Menu


基于Mootools的菜单,看起来和Flash做的没两样,可以选择多种动画效果,很酷 :cool:
点击查看

基于Mootools 1.2的超酷菜单


点击查看
源码下载
演示horizontal
演示vertical

Javascript和PHP的xml to json

最近在写一个yupoo应用,基于ajax的,所以需要将xml转换为json,在网上搜索后找到两个不错的类
PHP服务端的XMLtoJSON

<?php
require_once("xml2json.php");
echo Xml2json::transformXmlStringToJson(xml_data);
?>

Javascript客户端的XMLtoJSON

<!-- 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
Powered by WordPress | Shop Free Cellular Phones at Bestincellphones.com. | Thanks to Best CD Rates, iCellPhoneDeals.com Offers Best Cell Phone Deals. and Incinerador De Grasa