Wednesday, August 17, 2005

www.canvasrus.com.au/

手头有一个项目,一个购物网站,例子:http://www.canvasrus.com.au/

这里写一个帖子,作为记录,总结,一边做一边写,希望对以后的项目有大的帮助。


已经完成的:
database design
GD libary 分割图片,参考
http://www.nyphp.org/content/presentations/GDintro/gd1.php

alpha
上传图片,储存图片路径,生成缩略图。
参考
http://www.devarticles.com/c/a/PHP/Creating-a-MultiFile-Upload-Script-in-PHP/1/

alpha1
改用 Build An Automated PHP Gallery System In Minutes
 参考 http://www.sitepoint.com/article/php-gallery-system-minutes

alpha2
图片的管理功能完全修改完毕,以适应现在的数据库
找到 shopping cart 例子
根据
Dreamweaver Article
Building a Persistent Shopping Cart with PHP and MySQL
http://www.macromedia.com/devnet/dreamweaver/articles/php_cart.html
admin部分全部完成,有log in,
(参考http://www.tutorialized.com/tutorial/Simple-login-script-with-Sessions/5288)
图片和各种产品的修改



2005-8-17
alpha3
To do:
shopping cart
根据
Dreamweaver Article
Building a Persistent Shopping Cart with PHP and MySQL
http://www.macromedia.com/devnet/dreamweaver/articles/php_cart.html
改写

改写products.php基本完毕,目前每次只能添加一个商品

2005-8-18
alpha3
To do:
完成cart.php,实现购买,查看和删除商品
给出所有product的preview链接

问题:是否要给出每次添加n个的选项?
页面间跳转注意给出的参数是否正确?
用户上传部分的具体细节要跟client讨论.

Done:
完成cart.php,实现购买,查看和删除商品
给出所有product的preview链接

出现的问题:sql的问题,已经解决

新问题:GD libray 生成的新图片偏色,不知道原因,在php user group new zealand上询问中

答案:
Okay here try this J (btw this can resize the image too)





$theImage = imagecreatetruecolor($newWidth, $newHeight);

$theSource = imagecreatefromjpeg($sourceImage);



// okay do it

imagecopyresampled($theImage, $theSource, 0, 0, 0, 0, $newWidth, $newHeight, $currentWidth, $currentHeight);

根据上面,把生成缩略图的地方也改为imageCreateTrueColor

现在整个网站基本成形

To do:
credit card gateway
user input details
write order to db
user upload image and order based on this image

beta1
解决的问题:
上传后有的文件变成一行,重新在UltraEdit新建一个空白文件,把当初最早的有回车的文件拷贝过来,另存来解决。好像是关于DOS格式的问题,也许是 /n, /r, /n/r在不同操作系统下的问题。
另一个是mysql查询的问题
DO:
$query = "SELECT * FROM table";
$result = mysql_query($query);

DO NOT:
$result = mysql_query("SELECT * FROM table");

No comments: