Amazon S3 + PHP = Awesome image hosting solution

Recently I have been looking for a solution to allow users of notpopular.com to have photo albums of unlimited size. Its a popular trend in social networks, and its way cooler then the 5 tiny images that are allowed on notPopular.com (1.0)

There are many technical problems that associated with having this kind of open system. One of the biggest problems is storage (disk space), and load on the web server. Each image takes up space on the hard drives, and requires attention from the web server when an image is requested, taking attention and CPU from other more important processes.

After looking at several options, I came across Amazon S3 (Simple Storage Service). Amazon S3 is an online storage web service offered by Amazon Web Services. It provides unlimited storage through a simple web services interface. Data can be easily stored and retrieved at any time, from anywhere on the web. Amazon charges in proportion to the amount of data stored and applies charges for sending and receiving data. A perfect solution for what I’m looking to do!

S3 would store the data, and would handle the load of the requests coming from users, allowing my web server to focus on more important tasks like PHP processing and MySQL queries.

Here is the price break down for amazon S3 usage:

  • Storage
    • $0.15 per GB-Month of storage used
  • Data Transfer
    • $0.10 per GB – all data transfer in
    • $0.18 per GB – first 10 TB / month data transfer out
    • $0.16 per GB – next 40 TB / month data transfer out
    • $0.13 per GB – data transfer out / month over 50 TB
    • $0.01 per 1,000 PUT or LIST requests
    • $0.01 per 10,000 GET and all other requests

Using the calculator tool they have, and looking at the notpop data and projected traffic, my monthly costs would be around $20 a month, and even if things doubled in time, it would still only be $40 a month. Very reasonable for the speed and reliability that a company like Amazon offers.

I found some great php classes to work with S3, particilarly one from Geoffrey P. Gaudreault over at neurofuzzy.net

I am also planing on using some CNAME records on the notPop server to mask the amazon URL. Should be easy to do.

Last night I started to sew Amazon S3 into the pending notPop 2.0 code base. I will make some follow up posts about how it goes once I really start using it.

do you pownce?

pownce.gif

I really like pownce.com

If you dont know what pownce is, maybe you know what mySpace bulletins are…

If not, they are notes that you blast out to all of your friends, and they can look at them or not look at them if they feel like it. Also, if they feel like it they can reply to them.

Pownce is a website that functions sort of like that but has a major twist to it… they have a desktop application like AIM that you can install also. You can see the bulletins in real time, or you can look at the website.

All I know is that I love using pownce, it makes my day at the office go by a lot faster. Right now pownce is invite only, so if you would like to join, please send me an email (joshhighland at gmail dot com) and I will hook you up.

If you already have a pownce account, I’m here http://pownce.com/JoshHighland

decrease the lazy, increase the code

no_procrastination.jpg

I realized last night that I need to stop being a lazy web developer, and get off my ass and make something happen.

I’ve sat back and watched all of these awesome website applications come online, like digg.com, pownce.com, facebook.com and more, and I say “thats awesome, I wish I would have come up with that”.

The truth of the matter is I CAN do something like that, and I have the potential right at my finger tips for it to be big. For the last, almost 6 years I have developed a small but fun social network, notPopular.com, with over 25,000 members.

I’ve been admittedly lazy with the site and have let it go stagnant over the last few years. Its dated and worn. A number of time I have started building the 2.0 version of the site, just to trash it and start again. Last night I fixed a javascript bug that I had known about for 2 years… talk about lazy.

I work in burst of development, an idea will hit me and I will code like mad for a week, and then not touch it for 2 months. This is laziness. I need to stop this. I need to be steady with my development.

I love to code, I love new ideas for sites. Social networks are very interesting to me.

Many times I have felt left out of the online cool club, and I would think to myself, “If I lived in the bay area, things would be different, I could collaborate with people and make the next digg, pownce, or twitter”. or “I program all day for ‘the man’, I don’t feel like coding when I get home”. I’ve realized that those are just an excuses for my laziness. I need to get off my ass and do something about it. I need to develop web applications, if thats what I want to really do with my life.

This is my promise to myself, to complete the web projects I start, and to become consistent with their development.

If someone is reading this and has some awesome ideas for notPopular.com, speak now…. I’m on a roll

Firefox: spell check any field

firefoxlogo.gif

I can’t spell. That no joke. If you have read my blog for any length of time, you will know this. One of my saving graces has been the built in spell checker in Firefox (I’ve already used it 5 times in this post!)

By default Firefox will only spell check large text areas. This is great for the bodies of forum and blog posts, but it doesn’t help when I am filling out a single line text box, like the subject of this blog, or a forum topic title.

There is a solution to this, so you can have Firefox’s spell check available to all fields in a browser:

In Firefox, do the following (ignore all quotes)

  1. type this in the browser address bar “about:config”
  2. look for “layout.spellcheckDefault”
  3. change the value to “2”
  4. restart firefox

cfdump in php!

At work, I write ColdFusion, at home I write PHP. I bounce back and forth between worlds. Jack of all trades, master of none I guess.

One thing that I have always loved about ColdFusion is the cfdump tag. You feed it any variable, and it will spit out whats in it. Struct, String, Array, Query, Object, XML, it doesnt matter, it just works. I would go as far to say that its one of the best native debugging resources I have ever seen in a web development language.

In PHP, you can do a print_r() and look at the source, but that is no where as cool as cfdump. I have longed for a cfdump style resource to be available in PHP. Today I got my wish when I stumbled upon “dBug”. http://dbug.ospinto.com

dBug is a small PHP class that duplicates the cfdump tag from ColdFusion

look how simple it is to use:

include_once("dBug.php");
new dBug($myVariable);

The output looks like this:
phpdump.gif

dBug will handle anything you throw at it, just like cfdump does. This is going to help me so much in the future. If you develop in PHP, I think that this class is a must have in your tool kit.

dBug is free! get it today from http://dbug.ospinto.com