开源

关于网站后台缩略图综合解决方法

Posted in 前端技术, 后端技术, 开源 on 一月 17th, 2011 by admin – Be the first to comment

这两天给一个iphone 的应用程序写支持数据时遇到的关于缩略图的问题!
写出来分享一下. 直接上代码.

我们要达到这样的效果!

功能点
1. 图片上传的格式与大小尺寸是变化的,所以我们需要一个程序来实缩略图(php)
2. 常用的功能封装成jquery插件形式来使用。

html结构代码

编号 标题 来源 日期 缩略图
12 为什么是黄小明' 新浪 2011-01-15 upload/thumbnail/2011/01/15/1295081305.jpg
11 测度2730211069556' 新浪 2011-01-15 upload/thumbnail/2011/01/15/1295095094.jpg
编号 标题 来源 日期 缩略图

jquery插件代码

(function($){
    /**
     * 显示缩略图插件
     * 接收缩略图php地址
     * @author  mark.chen maxtank@gmail.com www.simcn.com
     * @date 2011-1-17
     **/
    $.fn.thumb = function(thumb){
        $(this).hover(function(){
            var url = $(this).text();
            var isAppend = $(this).find('span')[0];
            if(!isAppend){
                $(this).append($(''));
            }else{
                $(this).find('span').show();
            }
            //console.log("url的值为: %s", url);
        },
        function(){
            $(this).find('span').hide();
        });
    }
})(jQuery);

//使用方法
//$('.pw').thumb('thumb.php');

php生成缩略图代码(部分代码来源于互联网,也不知道是谁发表的)

/**
 * 生成缩略图
 * http://www.simcn.com
 * @param $_GET['f'] 图片地址
 * @param $_GET['w'] 图片宽度 默认为200
 * @param $_GET['h'] 图片高度 默认为200
 * @author mark.chen maxtank@gmail.com
 * @version 1.0
 **/

ini_set('memory_limit', '-1');

//传入参数
$width  = isset($_GET['w']) ? intval($_GET['w']) : '200' ;
$height = isset($_GET['h']) ? intval($_GET['h']) : '200' ;
$f		= trim($_GET['f']);

if(empty($f)){
	exit('需要传入f');
}

$info_orig = getimagesize($f);
$width_orig  = $info_orig[0];
$height_orig = $info_orig[1];

header('Content-type: '.$info_orig['mime']);
//header('Content-type: image/jpeg');
//header('Content-type: image/png');

$ratio_orig = $width_orig/$height_orig;
if($width/$height > $ratio_orig) {
   $width_ = $width;
   $width = $height*$ratio_orig;
   $pos_x = intval(($width_ - $width)/2); //位移X轴
   $pos_y = 0;
} else {
   $height_ = $height;
   $height = $width/$ratio_orig;
   $pos_x = 0;
   $pos_y = intval(($height_ - $height)/2); //位移Y轴
}

// 建立画布
$im = imagecreatetruecolor(200, 200);
$color = imagecolorallocate($im, 255, 255, 255);
imagefill($im, 0, 0, $color);		//填充背景为白色
//imagecolortransparent($im,$color);	//将背景透明化

switch($info_orig['mime']){
	case 'image/jpeg':
		$image  = imagecreatefromjpeg($f);
		imagecopyresampled($im, $image, $pos_x, $pos_y, 0, 0, $width, $height, $width_orig, $height_orig);
		imagejpeg($im, null, 100);
		break;
	case 'image/png':
		$image  = imagecreatefrompng($f);
		imagecopyresampled($im, $image, $pos_x, $pos_y, 0, 0, $width, $height, $width_orig, $height_orig);
		imagepng( $im );
		break;
	case 'image/gif':
		$image  = imagecreatefromgif($f);
		imagecopyresampled($im, $image, $pos_x, $pos_y, 0, 0, $width, $height, $width_orig, $height_orig);
		imagegif($im, null, 100);
		break;
}

使用PHPXref生成PHP开发文档

Posted in 后端技术, 开源 on 八月 15th, 2009 by admin – Be the first to comment

PHPXref是一个开源项目使用perl编写.
phpdoc生成开发文档时要配置一堆东西. 而且又很难用.
最近发现这个不错

下载地址:
http://sourceforge.net/projects/phpxref/files/phpxref/0.7/phpxref-0.7-win32.zip/download

这个不需要安装prel 环境
配置 phpxref.cfg

一般修改4个地方:
SOURCE=C:\phpxref\source #源代码
OUTPUT=C:\phpxref\output #输出
PROJECT=Unnamed Project #项目名称
CHARSET=utf-8 #中文的话修改一下编码

其他的还没有我没有用到, 大家可以试试

最后执行一下 phpxref.exe

开源软件公司目录列表

Posted in 开源 on 一月 8th, 2009 by admin – Be the first to comment

1. ActiveGrid

A: 150 Spear Street Ste 525 San Francisco CA 94105

W: http://www.activegrid.com/

2. ActiveState

A: 1700–409 Granville Street Vancouver BC Canada

(49.2262301, -123.1397438)

W: http://www.activestate.com/

3. Alfresco

A: Park House Park Street Maidenhead Berkshire SL6 1SL

G: (51.5217752, -0.7257843)

W: http://www.alfresco.com/

4. Apache Software Foundation

A: 1901 Munsey Drive Forest Hill MD 21050-2747

W: http://www.apache.org/

5. Astaro

A: 3 New England Executive Park Burlington MA 01803

W: http://www.astaro.com/

6. Black Duck

A: 100 Beaver St Waltham MA 02453

W: http://www.blackducksoftware.com/

7. Canonical

A: 1 Circular Road Douglas Isle of Man IM1 1AF

W: http://www.canonical.com/

8. Centeris

A: 15405 SE 37th Street Suite 110 Bellevue WA 98006

W: http://www.centeris.com/

9. CodeWeavers

A: 2356 University Ave West Suite 420 Saint Paul MN 55114

W: http://www.codeweavers.com/

10. Collax

A: 19 Crosby Drive Bedford MA 01730

W: http://www.collax.com/

11. Compiere

A: 2828 SW Corbett Avenue Suite 130 Portland OR 97201

W: http://www.compiere.com/

12. Digium

A: 150 West Park Loop Suite 100 Huntsville AL 35806-3303

W: http://www.digium.com/

13. Eclipse Foundation

A: 102 Centrepointe Drive Ottawa Ontario

(45.3465958, -75.7660532)

W: http://www.eclipse.org/

14. Emu Software

A: 128 Towerview Court Cary NC 27513

W: http://www.emusoftware.com/

15. EnterpriseDB

A: 33 Wood Avenue South Iselin NJ 08830-2735

W: http://www.enterprisedb.com/

16. FiveRuns

A: 8601 RR 2222 Building 1 Suite 100 Austin TX 78730

W: http://www.fiveruns.com/

17. Free Software Foundation

A: 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301

W: http://www.fsf.org/

18. Funambol

A: 643 Bair Island Road, Suite 305 Redwood City CA 94063

W: http://www.funambol.com/

19. Greenplum

A: 1900 South Norfolk Drive Suite 224 San Mateo CA 94403

W: http://www.greenplum.com/

20. GroundWork

A: 139 Townsend Street Suite 100 San Francisco CA 94107

W: http://www.groundworkopensource.com/

21. Haansoft

A: 20~22F., Prime Center, 546-4 Guui-Dong, Kwangjin-Gu, Seoul, 143-200, Korea

W: http://www.haansoft.com/

22. Hyperic

A: 329 Bryant Street Suite 2D San Francisco CA 94107

W: http://www.hyperic.com/

23. IBM

A: New Orchard Road Armonk New York 10504

W: http://www.ibm.com

24. Ingres

A: 500 Arguello Street Suite 200 Redwood City CA 94063

W: http://www.ingres.com

25. JasperSoft

A: 303 Second Street Suite 450 NorthSan Francisco CA 94107

W: http://www.jaspersoft.com/

26. JBoss

A: 3340 Peachtree Road NE Suite 1200 Atlanta GA 30326

W: http://www.jboss.com/

27. Linspire

A: 9333 Genesee Ave 3rd Floor San Diego CA 92121

W: http://www.linspire.com/

28. Linux Networx

A: 14944 Pony Express Rd Bluffdale UT 84065

W: http://www.linuxnetworx.com/

29. Mandriva

A: 43 rue d’Aboukir 75002 Paris France

G: (48.8791671, 2.3071289)

W: http://www.mandriva.com

30. Miracle Linux

A: San Marino Shiodome 5F 2-4-1,higashishimbashi,minato-ku,Tokyo 105-0021 Japan

W: http://www.miraclelinux.com/

31. MontaVista

A: 2929 Patrick Henry Drive Santa Clara CA 95054

W: http://www.mvista.com/

32. MySQL

A: Bangårdsgatan 8 S-753 20 Uppsala Sweden

G: (59.8448149, 17.6879883)

W: http://www.mysql.com/

33. Novell

A: 404 Wyman Suite 500 Waltham MA 02451

W: http://www.novell.com/

34. ObjectWeb Consortium

A: 655 avenue de l’Europe Montbonnot 38334 SAINT-ISMIER Cedex FRANCE

G: (45.2489087, 5.8272171)

W: http://www.objectweb.org/

35. OpenLogic

A: 10901 W 120th Ave Suite 450 Broomfield CO 80021

W: http://www.openlogic.com

36. pen Source Development Labs

A: 12725 SW Millikan Way Suite 400 Beaverton OR 97005

W: http://www.osdl.org/

37. Open-xchange

A: 303 South Broadway Tarrytown New York 10591

W: http://www.open-xchange.com

38. Optaros

A: 60 Canal St 4th Floor Boston MA 02114

W: http://www.optaros.com/

39. Penguin Computing

A: 300 California Street Suite 600 San Francisco CA 94104

W: http://www.penguincomputing.com/

40. Pentaho

A: 5950 Hazeltine National Drive Orlando FL 32822

W: http://www.pentaho.com/

41. Pervasive

A: 12365 Riata Trace Parkway Austin TX 78727

W: http://www.pervasive.com/

42. PosgreSQL Inc

A: 360 Main Street Suite 21 Wolfville NS

G: (45.0910352, -64.3661499)

W: http://www.pgsql.com/

43. Progeny

A: 8335 Allison Pointe Trail Suite 160 Indianapolis IN 46250-1790

W: http://www.progeny.com/

44. Qlusters

A: 1841 Page Mill Road Unit G2 Palo Alto CA 94304

W: http://www.qlusters.com/

45. Red Flag

A: 6/F. Zijin Building , 68 Wanquanhe Rd. , Haidian Dist., Beijing 100086, P.R.China

W: http://www.redflag-linux.com/eindex.html

46. Red Hat

A: 1801 Varsity Drive Raleigh North Carolina 27606

W: http://www.redhat.com/

47. rPath

A: 1121 Situs Court Suite 290 Raleigh NC 27606

W: http://www.rpath.com

48. Scali

A: 225 Cedar Hill Street Marlborough MA 01752

W: http://www.scali.com/

49. Scalix

A: 1400 Fashion Island Blvd San Mateo CA 94404

W: http://www.scalix.com/

50. Sendmail

A: 6425 Christie Ave Suite 400 Emeryville CA 94608

W: http://www.sendmail.com/

51. Sourcefire

A: 9770 Patuxent Woods Drive Columbia MD 21046

W: http://www.sourcefire.com/

52. SourceLabs

A: 411 First Ave S Ste 403 Seattle WA 98104

W: http://www.sourcelabs.com/

53. SpikeSource

A: 2000 Seaport Blvd 2nd floor Redwood City CA 94063

W: http://www.spikesource.com/

54. SugarCRM

A: 10050 North Wolfe Road SW2-130 Cupertino CA 95014

W: http://www.sugarcrm.com

55. Sun

A: 4150 Network Circle Santa Clara CA 95054

W: http://www.sun.com/

56. Sun Wah Linux

A: 12/F 9 Des Voeux Road West Hong Kong

G: (22.1059988, 114.0820313)

W: http://www.sw-linux.com

57. SWsoft

A: 13755 Sunrise Valley Drive Suite 600 Herndon VA 20171

W: http://www.swsoft.com/

58. Trolltech

A: Sandakerveien 116 NO-0484 Oslo

G: (59.8999583, 10.7336426)

W: http://www.trolltech.com/

59. Turbolinux

A: Morimo-Building 5F 3-3-5 Shibuya Shibuya-ku Tokyo 150-0002 Japan

G: (35.728677, 139.6801758)

W: http://www.turbolinux.com/

60. Univa

A: 1001 Warrenville Road Suite 550 Lisle, IL 60532

W: http://www.univa.com/

61. VA Linux Systems Japan

A: Harumi Island Triton Square Office Tower W 16th FL 1-8-16 Harumi Chuo-ku Tokyo 104-0053

G: (35.728677, 139.6801758)

W: http://www.valinux.co.jp/en/

62. Vyatta

A: 1 Waters Park Drive Suite 160 San Mateo CA 94403

W: http://www.vyatta.com/

63. Wind River

A: 500 Wind River Way Alameda CA 94501

W: http://www.windriver.com/

64. Xandros

A: 149 Madison Ave Suite 803 New York NY 10016

W: http://www.xandros.com/

65. XenSource

A: 2300 Geng Road Suite 250 Palo Alto CA 94303

W: http://www.xensource.com/

66. Zend

A: 19200 Stevens Creek Blvd Suite 100 Cupertino CA 95014

W: http://www.zend.com/

67. Zenoss

A: 275 West St. Suite 316, Annapolis, Md 21401

W: http://www.zenoss.com/

68. Zimbra

A: 1500 Fashion Island Boulevard San Mateo CA 94404

W: http://www.zimbra.com/

69. Zmanda

A: 505 N. Mathilda Ave 120 Sunnyvale CA 94085

W: http://www.zmanda.com/

开源软件公司目录列表下载:

http://blog.joylinux.org/zhaoke/2006/0708/ossc_lists.txt

参考:

1. Penguinsuit – http://penguinsuit.blogspot.com/

InfoWorld 2008 开源软件获奖名单

Posted in 开源 on 十一月 5th, 2008 by admin – Be the first to comment

你有用了几个

一、collaboration|协同类软件
1. elgg:社会性网络构建平台
2. MediaWiki:Wiki应用构建平台
3. Scalix:邮件和日程协同管理
4. VNC:远程管理软件
5. WordPress:BLOG系统构建软件

二、developer tools|开发工具
1. db4o:面向对象数据库引擎
2. Git:版本控制软件
3. HttpClient:Http协议组件包
4. TBB:多核CPU优化开发
5. JBoss Drools:业务规则引擎
6. Flex:富Internet应用构建
7. Prototype:JS基础框架
8. SoapUI:Web Services测试工具

三、networking|网络应用
1. Asterisk:软VOIP电话系统解决方案
2. AWStats:日志分析工具
3. inSSIDer:WIFI网络扫描软件
4. Nagios:系统和网络的应用监控程序
5. NDISwrapper:Linux系统使用Windows的WIFI驱动
6. Vyatta:路由器/防火墙
7. Wireshark:网络嗅探
8. Zenoss Core:网络监控软件

四、platforms and middleware|平台和中间件
1. CentOS:服务器操作系统
2. JBossESB:SOA业务组件
3. MYSQL:数据库平台
4. phpMyAdmin:最佳开源MySQL管理工具
5. Puppy Linux:小操作系统
6. Jitterbit:数据整合解决方案
7. Ubuntu:开源桌面系统
8. VirtualBox:虚拟桌面
9. Xen:服务器虚拟机

五、productivity apps|应用软件
1. Audacity:音频编辑软件
2. Blender:3D建模
3. FireFox:网络浏览
4. GIMP:图像编辑
5. OpenOffice:办公软件套装
6. PDFCreator:PDF创建软件

六、security|安全
1. AppArmor:应用软件安全
2. Metasploit:渗透测试、漏洞研究
3. Ophcrack:Windows密码恢复
4. SmoothWall Express:防火墙软件
5. Snort with Base:入侵检测
6. Splunk:安全日志分析
7. TrueCrypt:磁盘加密软件
8. Untangle:网关安全

七、存储软件
1. Amanda:网络备份软件
2. FreeNAS:存储服务器
3. Free Online Backup:在线备份
4. WinMerge:文件比较
5. smartmontools:磁盘监控
6. StorageIM:存储管理系统

SourceForge 2008 社区选择奖
最佳项目:OpenOffice.org
最佳企业项目:OpenOffice.org
最佳教育项目:OpenOffice.org
最有可能成为下个10亿美元收购项目:phpMyAdmin
最佳多媒体项目:VLC
最佳娱乐项目:XBMC
最有可能改变世界的项目:Linux
最佳新项目:Magento(一个电子商务平台)
最有可能被无端起诉侵犯专利的项目:Wine Is Not an Emulator(Wine)
最有可能让使用者遭到无端起诉的项目:eMule
最佳系统管理工具:phpMyAdmin
最佳开发者工具:Notepad++

大部分可以在 sf.net 找到.