AS3位图存储 [英] AS3 Bitmap storage

查看:195
本文介绍了AS3位图存储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿, 我需要一些建议,所以我将解释什么,我试图完成,我怎么觉得我要做到这一点,我希望有人能告诉我,如果这是一个好主意,或者如果我过思考它。

Hey, I need some advice so I'll explain what I'm trying to accomplish, how I think I want to do it and I hope someone can tell me if this a good idea or if I'm over-thinking it.

我想这样做,需要一个位图图像从AS3 / Flash的IDE项目,并将其保存在数据库服务器上的内容。这是一个有4个闪存应用程序运行和永久安装都链接到一个MySQL数据库。

What I want to do it take a bitmap image from an as3/Flash IDE project and save it on a database server. This is a permanent installation that has 4 flash apps running and they all link to a MySQL database.

我发现<一href="http://www.ghostwire.com/blog/archives/as3-serializing-bitmaps-storing-bitmapdata-as-raw-binarybytearray/"相对=nofollow>这个的教程,显示我如何序列化的BitmapData,然后将其存储在本地计算机上,但我想,而不是喜欢做的是,COM $ P $的pssed位图数据在数据库中存储BLOB字段。这是一个好主意? 如果没有,我可以将它发送到PHP到BitmapData存储到服务器上的文件夹和存储对它的引用在数据库中?我可以将其转换为JPEG从服务器此刻的电子邮件,但我需要一个副本仍处于位图格式被拾起由5应用程序,并打印出来。 如果我这样做保存为一个文件,我应该再使用PHP来获取文件和流的字节数回Flash?是否有这样做的更好的办法?

I found this tutorial that shows me how to serialize bitmapdata and then store it on the local computer but what I'd instead like to do is store that compressed bitmap data in the database in a blob field. Is this a good idea? If not can I send it to php to store the bitmapdata into a folder on the server and store a reference to it in the database? I can convert it to jpeg to email from the server at the moment but I need a copy that is still in bitmap format to be picked up by a 5th app and printed out. If I do store it as a file should I then use PHP to grab the file and stream the bytes back to Flash? Is there a better way of doing it?

任何教程或code段将大大AP preciated。如果不只是对权利主体推动的阅读起来。

Any tutorials or code snippets would be greatly appreciated. If not just a push towards the right subject to read up on.

谢谢你们。 本

推荐答案

已经有过关于是否要存储图像在数据库本身这些年来大讨论。我想大部分是结束了,共识正在迅速前往其存储在一个链接的文件系统......你可以缩放,高达容易,但扩展了DB是非常非常困难。所有这一切的罚款由我,因为我一直以为DB家伙疯了。

There has been great debate over the years about whether or not to store images in the DB itself. I think most of that is over and the consensus is rapidly heading to 'store it on the filesystem with a link'... you can scale that up easily, but scaling up a DB is much much harder. All of that's fine by me, because I always thought the DB guys were nuts.

有关转让过线,我建议PNGing的图像,这取决于它是什么样的形象(PNG既是COM pressed和无损)。

For transfer over the wire, I'd suggest PNGing the image, depending on what kind of image it is (PNG is both compressed and lossless).

如何存储文件将取决于您的应用程序的结构。你也许可以得到与全MD5的大文件夹生成的文件名以prevent碰撞。你可能不希望连续存储任何东西,因为这很容易让别人进来,只是把整个集合。您还可以将自动生成的文件名,用户id'd文件夹......这完全取决于你。

How to store the file will depend on how your app is structured. You can probably get by with large folders full of MD5 generated filenames to prevent collision. You probably don't want to store anything serially, as that makes it easy for somebody to come in and just take the entire set. You can also store autogenerated filenames in user id'd folders... that's up to you.

除非高安全性是必要的,你可以让他们所有的Web服务器上,并拍背的URL,这使得文件一应俱全。如果你需要让他们私人的,那么你就可以流回用PHP。请确保您使用ETag时或一些​​其他缓存机制。

Unless high security is needed, you can just keep them all on a Web server and shoot back a URL, which makes the files readily available. If you need to keep them private, then you can stream them back with PHP. Make sure you use Etags or some other caching mechanism.

补充:
顺便说一句,在PHP / MySQL的部分实际上是pretty的方便。总而言之,一个经验丰富的职业能做到这一点的几天 - 一周上衣

Added:
Btw, the PHP/MySql part is actually pretty easy. All in all, a seasoned pro could do it in a couple of days -- week tops.

和这里的AS3 PNG EN codeR,这是的包含AS3CoreLib

And here's the AS3 PNG encoder, which is part of AS3CoreLib

这篇关于AS3位图存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆