{"id":413,"date":"2007-07-26T02:24:15","date_gmt":"2007-07-26T02:24:15","guid":{"rendered":"http:\/\/sketchbooks.com\/invis\/wordpress\/?p=413"},"modified":"2016-03-31T10:21:26","modified_gmt":"2016-03-31T14:21:26","slug":"how-i-built-my-dynamic-portfolio-website","status":"publish","type":"post","link":"http:\/\/invisibleman.com\/2007\/07\/how-i-built-my-dynamic-portfolio-website\/","title":{"rendered":"How I built my dynamic portfolio website"},"content":{"rendered":"
<\/p>\n
\nFor an illustrator or designer, redesinging one’s web portfolio can be one of the most gut-wrenching projects to work on, as you are often your own worst client to work for. I have probably dozens of photoshop files of various versions of ‘new’ designs for my website that never got built. Meanwhile, my site was growing some cobwebs, and my long-overdue overhaul was dead in the water.\n<\/p>\n
\nSo last fall, I made a deal with myself: You can keep the general design of the site in tact for the time being, but for god’s sake, make the site dynamic — SOMEHOW…and do it fast!\n<\/p>\n
<\/p>\n
\nWhat do I mean by dynamic? I mean NOT a directory with 100 odd HTML pages, totally unlinked by any kind of navigation, each with different copyright dates at the bottom, hundreds of mutations of the old crappy HTML table layout. That was exaclty what my site consisted of when I started this project.\n<\/p>\n
\nHaving used the MovableType<\/a> content management system so much (which powers this fine website), I was determined to add some sort of database to hold all of my illustration entries, and have templates for each type of page I wanted. And most importantly, a REAL navigation that would be totally automatic, that would allow you to easily navigate between all of the pages on my site, without having to keep going back to the front page again to start all over. And the gravy would be a quick web-based method of administering the conent allowing me to edit the site from anywhere. But that’s just gravy. Not necessary.\n<\/p>\n \nI was inspired by Nate Williams<\/a> over at Illustration Mundo<\/a>, who built his whole fantastic site from scratch, after learning MySQL\/PHP. He recommended a great book, and his description of how he tackled the project made it sound very doable, so I figured I’d take a stab at it.\n<\/p>\n \nSo as luck would have it, while walking down the street to Gorilla coffee one day, I found a perfect copy of Larry Ullman’s excellent “PHP and MySQL For Dynamic Web Sites”<\/a> sitting on a stoop of a brownstone. This must be fate! This was the book recommended to me by Nate Williams<\/a>. I read through the basics, and decided what would be in the database.\n<\/p>\n \nThe database would hold an individual record for each illustration with the follwing information stored in it:\n<\/p>\n \nThen I would make an ‘illustration detail’ page template that would use the ID number to fetch the data.\n<\/p>\n MySQL\/PHP<\/strong><\/p>\n \nMySQL is the software that crates, manages, queries and communicates with the database. PHP is the scripting language that is the link between the dynamic webpage and the data on the database. PHP code sits nestled among HTML, and allows for all sorts of tricks to fetch and process data from the database query. These are often mentioned together in the same breath (it’s a very common pairing), and they work very well together.\n<\/p>\n \nI should note that my experience with programming \/ scripting is mainly from Actionscript in Adobe’s Flash. It was very easy to start working with PHP, as it’s not terribly far from Actionscript or Javascript, and you won’t feel lost if you have experience with either of these, or any other scripting language.\n<\/p>\n Fill the Database<\/strong><\/p>\n \nI had all 100 or so of my old illustration pages lying around, so I went through and extracted all of the text that I could, trying to get it all in one text file in BBedit, so it would be easier to insert it all into the database at once. After much text wrangling, I was able to import all of the text from my old pages into the database. I used the open-source CocoaMySQL<\/a> which has a friendly GUI interface, which made accessing the records in the database much more like using FileMaker.\n<\/p>\n A note on web hosting and databases…<\/b> PHP page templates<\/strong><\/p>\n \nOnce I had the database populated with information on my illos, I started to write the illustration detail page in HTML \/ PHP that would take a unique ID number from the end of the URL, and using that number, fetch the correct illustration record. So I cleaned up one of the more recent pages from my old site, added the PHP code, made a hook for the dynamic ID number, and cleaned up the code so it was all compliant.\n<\/p>\n \nThe nice part is that I only have ONE page to do his for. All the pages spit out the same copyright, and ‘wrapper’ for the dynamic content. They have the same exact code, so any changes happen on just one page. I then got the navigation working (you basically just increase the ID to go forward, or decrease it to go backwards), which was a bit more work, but went smoothly.\n<\/p>\n \nSince the detail page went so quick, I quickly whipped up other dynamic pages, I had long wanted on my site.\n<\/p>\n Automatic Thumbnails & Image Resizing<\/strong><\/p>\n \nI also wanted to have automatic thumbnails and resized images created each time I upload an image to the site. Using the open-source ImageMagick<\/a> UNIX graphics libraries, I set up a web form that lets me upload an image from my desktop, then it resizes the image, and generates several versions of the same image. I picked two auto-cropped square thumbnail sizes, and then two proportional scaled versions of the whole image.\n<\/p>\n \nNow that I had thumbnails of different sizes, it allowed for all sorts of cool things.\n<\/p>\n \nIt was very easy to generate a random quilt of images, using different thumbnail sizes, such as these:\n<\/p>\n \nhttp:\/\/jonkeegan.com\/RAND.php?th=1&rows=6&cols=5<\/a> \nThis is what is used in my new “Random Recent Illustrations” panel on my front page.\n<\/p>\n \nI added a client view page, which takes the name of a client, then spits out all of the illustrations for that client. I also made a dynamic news page, so I can add news items to the database, and easily show an archive of all of the news entries.\n<\/p>\n \nhttp:\/\/jonkeegan.com\/client_list.php?th=2&client=The+New+York+Times \nThe latest tool I added to the back-end is an interactive cropping tool. This is essentially the exact tool I put together at my day job at WSJ.com, to help the editors make simple and quick crops to photos running on the website. This works really well (uses the excellent scriptalicious<\/a> Javascript library), and I wanted to be able to pick the crops for my square thumbnail images. I just went back and re-cropped all the auto-cropped images that looked bad, to make sure to focus on the faces of the characters in the illos, and it just looks so much better when you see them all on a page.\n<\/p>\n \nAlso, for adding new illustrations and editing old ones to this cool system, I would a simple editor of sorts that would let me quickly browse through the entries and make tweaks, and add new entries. This was much easier than I would have thought. I whipped this ugly but usable editor, and I have been using it for several months now.\n<\/p>\n \nOf course, the visual design of the site is still due for a big reworking, as is the HTML and CSS. There are ugly tables everywhere and embarrassingly bad CSS all over the place still (I didn’t know what I was doing in regards to CSS back then). I am looking forward to starting from scratch, knowing that all I need to build is a shell for all this dynamic content. It’s a much more manageable job now, and I can focus on making the work look really good, and the information easy to read, and improving the navigation.\n<\/p>\n\n
\nIf you are interested in tinkering with this stuff on your website, make sure you find out what your web host’s database policy is. Each hosting place sets them up slightly differently for their users, that is if your account supports them at all. I have hosted my site (and invisibleman) at Pair Networks in Pittsburgh (since 1996!) and they have an excellent and simple dashboard to setup databases on your account very quickly. I didn’t have to do any installation of software to get going, which was a huge help.<\/p>\n
\n
\n
\n\n<\/div>\n
\nhttp:\/\/jonkeegan.com\/RAND.php?th=0&rows=3&cols=10<\/a>\n<\/p>\n
\n<\/a><\/p>\n
\nContent Editor<\/strong><\/p>\n