Sina App Engine 试用小记(2 位领导批示)

首先扫扫盲

Sina App Engine 是由新浪在近期低调发布了基于PHP的Web应用开发和运行平台(Alpha),致力于为广大SAE开发者提供简单高效的分布式应用环境。

据说是sina内部测试的.只有200个名额. 实在是好奇. 弄到了个账号测试测试. http://bbs.blueidea.com/thread-2956594-1-1.html (^_^)

用过之后有点失望.限制N多(phpinfo都被禁止.更不要谈别的系统函数).不过一个免费的玩意不可能太多功能.HOHO.

11M的memcached. mysql支持. 管理起来还算相当方便. 本想放一个punbb进行测试.无奈几次上传后都不能安装.遂放弃.上传一个N久前写的小代码(访问: http://1.silver.sinaapp.com/). 速度还可以.当虚拟主机用了..HOHO

后台载图

Tags : , ,

PHP处理简单图片的颜色填充(0 位领导批示)

原问题地址: http://bbs.blueidea.com/viewthread.php?tid=2956421


现在有一张背景色为纯蓝色(或者红色等) 并且与照片里人物有很明显的反差色彩 的一寸单人照照片,现想把,该图片中的蓝色背景用PHP处理为白色。即类似于PS中,用白色填充蓝色的效果。

使用GD库的imagecolorset函数可以修改简单的索引色. 不过只能对gif与png图片有效

1
2
3
4
5
6
7
8
<?php
$img = file_get_contents('http://home.blueidea.com/attachment/200911/9/207382_1257738485WdvH.gif');
$im = imagecreatefromstring($img);
$bg = imagecolorat($im, 0, 0);
imagecolorset($im, $bg, 0, 0, 255);
imagepng($im);
imagedestroy($im);
?>

[备忘]安装PHP扩展时需要同时安装的扩展列表(0 位领导批示)

仅备忘

php_curl.dll CURL, Client URL library functions Requires: libeay32.dll, ssleay32.dll (bundled)
php_domxml.dll DOM XML functions PHP <= 4.2.0 requires: libxml2.dll
(bundled) PHP >= 4.3.0 requires: iconv.dll (bundled)
php_fdf.dll FDF: Forms Data Format functions. Requires: fdftk.dll
gnu_gettext.dll (bundled), PHP >= 4.2.3 requires libintl-1.dll,
php_iconv.dll ICONV characterset conversion Requires: iconv-1.3.dll
php_ingres.dll Ingres II functions Requires: Ingres II libraries
php_interbase.dll InterBase functions Requires: gds32.dll (bundled)
php_java.dll Java functions PHP <= 4.0.6 requires: jvm.dll (bundled)
php_ldap.dll LDAP functions PHP <= 4.2.0 requires libsasl.dll(bundled),
PHP >= 4.3.0 requires libeay32.dll,ssleay32.dll (bundled)
php_mcrypt.dll Mcrypt Encryption functions Requires: libmcrypt.dll
php_mhash.dll Mhash functions PHP >= 4.3.0 requires: libmhash.dll (bundled)
php_mcrypt.dll Mcrypt Encryption functions Requires: libmcrypt.dll
php_mhash.dll Mhash functions PHP >= 4.3.0 requires: libmhash.dll (bundled)
php_msql.dll mSQL functions Requires: msql.dll (bundled)
php_mssql.dll MSSQL functions Requires: ntwdblib.dll (bundled)
php_mysql.dll MySQL functions PHP >= 5.0.0, requires libmysql.dll (bundled)
php_mysqli.dll MySQLi functions PHP >= 5.0.0, requires libmysqli.dll (bundled)
php_oci8.dll Oracle 8 functions Requires: Oracle 8.1+ client libraries
php_openssl.dll OpenSSL functions Requires: libeay32.dll (bundled)
php_oracle.dll Oracle functions Requires: Oracle 7 client libraries
php_sybase_ct.dll Sybase functions Requires: Sybase client libraries
php_xmlrpc.dll XML-RPC functions PHP >= 4.2.1 requires: iconv.dll (bundled)
php_xslt.dll XSLT functions PHP <= 4.2.0 requires sablot.dll, expat.dll (bundled).
PHP >= 4.2.1 requires sablot.dll, expat.dll, iconv.dll (bundled).

转换avatar头像函数(0 位领导批示)

仅备忘

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/**
 * 获取 avatar 头像
 *
 * @param string $email
 * @param integer $size
 * @return string
 */
function getAvatar($email, $size = '24')
{
	if (!is_numeric($size))
	{
		$size = '24';
	}
	if (!empty($email))
	{
		$out = 'http://www.gravatar.com/avatar/' . md5(strtolower($email)) . '?s=' . $size;
		$avatar = "<img src='{$out}' class='avatar avatar-{$size} photo' height='{$size}' width='{$size}' alt='{$email}' /> " . $email;
	}
	else
	{
		$avatar = $email;
	}
 
	return $avatar;
}

[备忘]几个不错的Flash Chart (图表)(0 位领导批示)

  • amCharts
  • AnyChart Flash Chart Component
  • Aurigma FlashChart
  • B-Line Charting Component
  • Corda’s PopChart
  • FusionCharts
  • Graph ZX
  • Open Flash Chart
  • PHP/SWF Charts
  • Rich Chart Builder
  • Swiff Chart
  • WA Dynamic Flash Charts
  • Tags : , ,

    [备忘]PHP无法加载LDAP扩展的解决方法(2 位领导批示)

    最近的项目中需要使用域账号访问域控服务器. 要开启PHP的LDAP扩展.

    打开php.ini后去掉 ;extension=php_ldap.dll 的分页.重启APACHE.
    刷新页面..显示 Call to undefined function ldap_connect()

    0_o 咋回事捏? 打开PHPINFO发现没有 LDAP.. 说明木有加载上..

    最终找到解决方法:


    将PHP目录下的libeay32.dll和ssleay32.dll拷贝到system32目录下.重启APACHE

    搞电.. (^_^)

    将指定的数组元素排在数组最后(0 位领导批示)

    原题目地址: http://bbs.blueidea.com/thread-2953135-1-1.html

    我的解法是删除那个数组元素再将array_push那个元素

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    
    <?php
    function moveArrayElement(& $arr, $element)
    {
        foreach($arr as $key => $value)
        {
            if($value == $element)
            {
                unset($arr[$key]);
            }
        }
        array_push($arr, $element);
    }
    $arr = array('楼主', '沙发', '板凳', '地板');
    moveArrayElement($arr, '楼主');
    print_r($arr);
    ?>

    全文阅读 »

    数组脏话查找关键字问题(4 位领导批示)

    原问题地址: http://bbs.blueidea.com/thread-2948905-1-1.html


    我想在数组含有“中国|||我国|||大地”,当有一句话同时出现“中国,我国,大地”时就提示有脏话,其他的如“ [2] => sex”就直接提示提示有脏话,这样数组怎样查找啊!大大们,出来帮我看看吧

    我的解决方法. 思路是遍历数组进行逐个比较.

    全文阅读 »

    国庆60周年倒计时牌(4 位领导批示)

    迎接祖国60周年华诞..抽空写了个倒计时牌(Javascript版本倒计时. 为奥运会写的)

    DEMO: http://www.zdyi.com/flash/countdown.swf

    全文阅读 »

    Tags : ,

    [备忘]Zend Studio for Eclipse 代码格式化(5 位领导批示)

    使用方法:

    打开 Window -> Preferences -> PHP -> Formatter 选择 Import 导入 xml 文件即可

    全文阅读 »

    随机显示的10篇日志

    评论最多的10篇日志

    浏览最多的10篇日志