I'm writing a web application in PHP which needs to store images and image meta data. In future, the application may need to work offline on the client. A user might need to download all the images and data to his laptop before going to a remote area without internet access. Whilst at the remote location the user could add new images to the system and be able to compare them with his local copy of the image database. When returning to an area with internet access, the user would run a sync operation which would copy his new images to the server and retrieve any new ones.
I've looked at the new web storage / localstorage options in HTML5 (web sql database seems to have been dropped) and I think this is going to be too limited as there is only 5MB space and one or two images could easily exceed that.
Is what I want to do actually possible / practical with a browser-based web application? Or should I be looking at writing a desktop/tablet application with local file storage capabilities for users without net access. Initially, it does need to be a web application, I'm just trying to think ahead. Will I give myself more options in future by using something like couchDB for the backend from the start? As I understand it, this comes with good syncing functionality.
Thanks,
I decided to use Titanium Desktop.
http://www.appcelerator.com/products/titanium-desktop-application-development/
Related
I am using mysql database, i have a web site. So now i decided to create a mobile application. But i have some image in ftp, and their path saved as a varchar in mysql.
I connect to mysql remotely in Android app. But i dont know which is the best way to show image on Android app.
I have 2 way to show it. First one is i can get an image path and show on an url in image view or the other one is i saved that images blob file in mysql and get the base64 encoded text and show. But which is the better way ?
Google has released an awesome library that handles HTTP requests and its main purpose is literally simplify developers life when they need to manage a huge amount of web requests, providing image caching solutions and avoiding the problems of concurrent programming, thread syncronization etc...
I'm talking about Volley
This great solution is exactly the solution to your problem, why? It's because it exposes a clear way to request remote image resources and caching them directly inside the app storage, without the inconvenient of using mobile network each time you open the app, refresh a fragment/activity or add a new element to a listview object.
This is done by implementing an image request method.
So, I think you should store your images on disk and save just their path inside the database, and then, from the app, make a request to your server, Volley will take care of getting the image and raising a callback when the request has been completed.
Simple and clear.
Current scenario :
There is a webservice (build in php/mysql). User filled data is stored on a remote server.
Issue is user has extremely bad internet connection, webservice is down most of the time. Is there a way to store data locally and sync it when internet is available?
Please note, user might not have database installed on his machine also there is no localserver to work with.
Even if user had some type of RDBMS installed on the box, you probably wouldn't have any way to communicate with it. You can use the HTML 5 Storage API, but it will not solve the connection issues.
And since localStorage (which you probably would use) is available directly only from JavaScript, you would have to make a complicated and fully functional JS application to utilize it.
Note: based on your profile, I would estimate that your JavaScript skills would not be adequate for such task.
If your target audience is mobile users, then you have another alternative: create a native application.
You would still be able to use HTML for the interface (using built in web browser components). But it also would let you have SQLite DB and file storage available on the mobile device, where you can cache the necessary data.
look at the features in HTML 5 for local storage
Typically I would go with IndexDB and then push the local data to the server once the connection is back
http://diveintohtml5.info/storage.html - Should give you a brief about the features and implementation.
I'm looking for some quick info about best practices on storing user's uploaded files on different servers or sub domains...
For example, photos on facebook of course arent on facebook.com/files/users/453485 etc...
but rather on photos.ak.fbcdn.net or whatever...
I'm wondering how with php i can upload to a different server whilst maintaining a mysql connection to my original... is it possible?
Facebook uses a content delivery network (cdn, hence fbcdn or facebook content delivery network) and probably uses webservices to pass binary data (photos) from server to server.
Rackspace Cloud offers a similar service. Here is an example application of their PHP library to access their webservice api: http://cloudfiles.rackspacecloud.com/index.php/Sample_PHP_Application
I'm going to make the assumption that you have multiple webservers, and want to be able to access the same set of files on each one. In that case, some sort of shared storage that each machine can access might be a good place to start.
Here are a couple options I've used:
Shared NFS Volume [ http://en.wikipedia.org/wiki/Network_File_System_(protocol) ]
MogileFS [ http://www.danga.com/mogilefs/ ]
Amazon S3 [ http://aws.amazon.com/s3/ ]
If you don't have control over the hardware or aren't able to install extra software, I'd suggest Amazon S3. There is an api that you can use to shuttle files back and forth. The only downside is that you don't get to use storage that you may already use, and it will cost you some money.
If you do have access to the hardware and software, MogileFS is somewhat like S3, in that you have an api to access the files. But is different in that you get to use your existing storage and get to do so for no additional cost.
NFS is a typical place where people will start, because it's the simplest way to get started. The downside is that you'll have to be able to configure servers, and setup a NFS volume for them to mount.
But if I were starting a high-volume photo hosting service, I'd use S3, and I'd put a CDN like Akamai in front of it.
I am trying to build an app for a photographer. These are his requirements:
Photographer can upload photos or files (files up to 20-30mb).
Photographer can categorize photos and files by client.
Photographer can create client username and passwords.
Photographer can send email from web interface to link to download. (which requires client login)
Client can login and view and download photos and files assigned to his account.
Photographer mentioned 1-2 terabytes of data needs to be stored.
So, my questions:
Is there an open source system out there that already does this.
Is there an app already out there that does this. Photographer currently uses "yousendit" but the free solution is not sufficient since data is lost after 2 weeks.
He mentioned he could host it on a box at his office, but his connection is limited.. thaughts? At that point storage space would not be an issue. I would have to code this app.
GoDaddy hosting for example does unlimited storage with one of its plans that is reasonable. If I coded my own app, this would be perfect. I do hate GoDaddy though..
I will listen to any alternative suggestions.
Thanks!!
I'm not sure about building an app like this, but SmugMug is an existing app that hits most of your requirements.
Can upload unlimited JPGs as part of base cost, other files can be uploaded at additional cost
Photos can be categorized into galleries per client.
Galleries can be locked down, with clients getting unique user/pass to their gallery
Not 100% sure if you can email a link directly from the site, but I believe you can.
Additionally, if you get a pro account, clients can order prints online (no need to build your own payment processing), you can "theme" the galleries how you like, automatic watermarking, etc.
The base cost is $40-$150/year, depending on what level you choose, plus whatever you need for additional file storage. Not sure if it meets all your needs, but just throwing it out there. Note: I am not affiliated w/ SmugMug, just a satisfied user.
The first question you need to answer is whether you will store the files in the database or on the file system. Given the amount of data in question, I would store the file on the file system and keep meta data about the files including their location in the database. The catch to this approach is that you have to keep the two in sync with each other. It is not particularly difficult to build that system.
The second question relates to where you store the files. You could store the at the same place where you host the site or you could use a cloud storage option like Amazon's S3 (or DreamHOst mentioned by J_B). One advantage of using cloud storage is that the site can hosted anywhere without affecting the location of the files.
DreamHost might not mind. They say they will give you all the storage your site needs with all plans (+ some extra for storing whatever you want).
I don't know about an app that does that. Doesn't sound REAL hard to write.
I need some guidance around how to develop the app I'm working on.
It's basically a backend system to manage photos and slideshows (eg arrange photos in albums, decide which ones to publish, update names and captions etc)
I would like to avoid giving the source code to clients but would like to keep the actual photos and thumbnails on the client's server.
I'm not sure what would be the best way to achieve this. In my mind the steps are:
a) client uploads a photo to MY site
b) photo is registered into my DB
c) the original photo is moved to client's server
d) thumbnails are generated and saved on client's server
then the public site:
e) install the public website on my client's server;
f) when a user is browsing the client's website, the script gets the list of images to show from my database, and gets them from the local server.
(hope I made myself clear)
basically the question is: what's the best way to give the client minimal/no access to the source code?
I agree with benjy, however, you can get away with using an API to manage the system specific calls, and just have an upload handler that communicates back to your API on the clints box, so they still have some code, it is minimal, and the code requires an API call to function. That way you reduce the DB need, and reduce the resources required to manage the clients code.
API is used to authenticate / manage communication while the upload / manage scripts handle the upload/image handling.
IMO, this seems a little unnecessary. What exactly is your concern about having the source code rest on a client's server? All you need is a signed license agreement between you and the client preventing them from doing anything with it.
Or, if you really don't trust them, just sell it as hosted software. No point in the above procedure, which is rather convoluted (no offense), when you can just have everything on one server.
Just my $.02.
You can obfuscate the code with a commercial tool like IonCubelink text, or you can develop your application and license it using a SaaS model, and provide an API for the client software to use.
Zend Guard, SourceGuardian, IonCube, and similar are other viable options if you cannot keep it local but want to make it difficult to find out what the "source" is.