Showing posts with label Drupal. Show all posts
Showing posts with label Drupal. Show all posts

Sunday, December 6, 2009

New Website In Production

In my last blog entry I wrote about learning Drupal (the web-content management system tool) and that I am rebuilding my website in it. Right now it only lives on my iMac at home but soon I will be relaunching enginpost.com and moving my blog over to that site. In the mean time, I am fairly happy with what I am able to do to build a very stylized gallery in Drupal.

These sample images show what the basic site will look like but I want to focus on the gallery.

Intuitive URLs

First, replace "localhost:8888/ep" right now (in your mind) with "enginpost.com" and check out the address to get to the gallery on my site:
The nice thing about clean URLs is that it makes content on your site quite memorable and less cryptic, which I prefer. So, once I go live, if a person wanted to check out all of the images in my gallery they would type in: http://enginpost.com/gallery


Here is a screen grab of the gallery page on the site will all five images I have uploaded (click the image to view a larger version.) I designed it to make each image look a bit like an old photo. No more than six images to a page and if there are more than six images then at the bottom of the images you get a "pager" which uses Ajax to move you through the images in groups of no more than six at a time.

Instant Sub Galleries Via Tagging (Taxonomy)


Next up, I like to take a lot of photos and currently I use flickr to manage all of that, but I am only allowed so many uploads per month. So, since I manage my own site (as well as pay for the space and bandwidth) I am going to start moving all of my images over to my new gallery. No more being spread across flickr and blogspot and enginpost.com for me. I will be all in one site.

The next important task in creating my image gallery is being able to easily tag the images and then find them again by searching through those tags (if you are not familiar with tagging, it is like labeling or indexing your images based on ad-hock categories. Said another way, imagine that you took a picture of a friend during Thanksgiving. Well, you might want to tag that picture of "frank" with the terms "Frank" and "Thanksgiving." Later you will want to search for and see all of you shots where you tagged "Thanksgiving" you should be able to pull up that image.)

Now, check out this URL. It is the same as above with the addition of "/scottish"

The idea here is that I can pull back only the images where I have tagged them with "scottish." In this case I tagged only 4 of the 5 images I uploaded (for testing) using that tag. So only those images come back!


Make note that the gallery title says "Gallery: (Scottish)" this time and not "Gallery: (All)" like it did in the earlier image (click the image above to view a larger version.) I am doing a couple of tricks. First, this is the same exact gallery page in Drupal. In fact it is the same basic core page for my entire web site but I have themed just the output of the images here so that they look like old photos. Second, Drupal is reading the URL to figure out if it needs to filter the results based on the tag term I put on the URL. When I themed the image content coming back I just did a little trick to be sure it capitalized "Scottish" even though it isn't capitalized in the URL. This way everything looks nice and consistent and professional.

Larger Image Versions Using Lightbox

Finally, just as I have been asking you to click these images to view a larger version, I wanted that same feature in my web site. I have noticed that people are using a technique these days which opens a larger version of the picture on top of the existing page rather than opening a different window, and I think that looks great. It is really the new standard for how site galleries operate so I went looking to see how that was done.

In the end I was able to pull this off quite easily in Drupal. In addition to that I was able to setup an image processing module that would take the huge images I was uploading and it created thumbnails and standardized large view sizes to make the gallery images incredibly consistent!


Notice in this image that you can also download the original image in it's even larger size once you have clicked to view the larger version. Beautiful! I also made it so that when you click one image to make it larger, it automagically starts a slideshow of any remaining images in the group. You can stop the slideshow at any time or manually advance the slideshow as well.

Drupal sure makes this stuff easy. If I had to do this sort of thing from scratch I don't have a clue how long it would take me to build out all of this functionality. In addition, the site design is completely mine (so one wouldn't necessarily assume this was a Drupal website by looking at it.) Beyond that the time I save now by allowing drupal to create thumbnail and standard larger views of my images more than makes up for the time it has taken me to learn how to do this stuff!

Very exciting geekery!

The Difference Between My Brain And A Web-CMS

That title is a joke. I am nothing like a web-content management system and so comparing my brain to the purpose of one is ridiculous. But I have been bashing my brain against one particular web-cms for a while now and while my head hurts from the steady rate of growth and discovery, I can say that the experience has been, well, glorious compare to the learning curve of other kinds of technology. I am talking about the web-cms Drupal.

I have learned a number of other languages over the years: Visual Basic, Cobal, Powerbuilder, Foxpro, C, Objective C, C#, .NET framework, Cold Fusion, PHP, ActionScript, JavaScript, Smalltalk and a few others (fhew!) The thing about most programming languages: it is a lot like riding a bike. There are many kinds of bikes out there, single gears, multiple gears, road bikes, trail bikes, and while they all ride differently, once you learn one the others implement the same basic expected functions (pedals, breaks, gear switching, turning, etc.) just not in the same way (rod-based gear changing, twist / crank gear changing, breaks on the handlebars, breaks on the pedals, etc.) With most languages the purpose remains the same, the tools to get you there are what change a bit.

Diving over into a web-cms is like tweaking a bike for a particular purpose. The seat, the handlebar grips, the shoes, did I mention the seat? A web-cms can implement many different approaches based on the technology (or programming language) beneath it. This means you need to know a bit about the programming language it is written in, but then you need to know how they used that language to put the whole thing together so you could snap it together in a custom manner: enter headache.

Drupal, the web-cms of my choosing, is really built on the best of the best. Allow me to throw out a few buzzwords: apache, MySQL, PHP, jQuery and Ajax. And Drupal sites tend to look amazing in old browsers as well as new browsers, index really well on sites like Google (sidenote: it is funny to think of a monolithic entity like Google as fundamentally a site) and plays really well with other technology. If Drupal were your kid, it would never disobey, would be infinitely creative and filled with potential, and you would never have to tell it to clean it's room.

Drupal is clearly the premier poster-child for Open-Source-Gone-Well. It nearly defines the phrase. Drupal is open source in that Drupal version 6 (the current version) included the participation of over 700 developers world-wide devoted to making this community product better.

And the magic of Drupal is in the contributed modules. These are little optional pieces of downloadable functionality, all open source, available for the purpose of adding functionality to the core web-cms that is Drupal. Do you want a site to run your personal blog? Core Drupal does that. Do you want to setup a community calendar and a photo gallery and manage document libraries with sign-in & sign-out capabilities? Go visit http://drupalmodules.com/ and you will find all of the Contrib. Modules you need to pull that off.

Learning Drupal is, however, just a bit sketchy, but not in the way you are anticipating. It isn't that Drupal information is difficult to find. On the contrary. There is too much information out there. And self-published experts range from goofy to golden-nuggets. The trick is getting good references from community members to find the right best sources of knowledge. In a sea of Drupal there are a few amazing stand-out sources that every wanna be Drupal user needs to find... but I am going to hord those references so you all don't benefit!!

That is joke. The first amazing source is IRC. That's right! I said it! Remember back in the day when AOL first came out and how cool it was to chat with people over the internet? Well, long before AOL pretended to BE the web, IRC was! IRC, or Internet Relay Chat, are these communities of like-minded folks who are chatting it up on various topics. In the Drupal IRC world, irc.freenode.net and #DRUPAL-SUPPORT are your bread and butter. I have received tips from everything from (1) great hosting services, to (2) how to enable features in my custom theme configuration, or (3) great book recommendations.

All in all, my career has taken a completely reborn turn in the last 3 years. I was completely invested in Microsoft a few years ago. If I were to explain my career in terms of technology I would have said: SharePoint, VB and C#, Ajax, CSS and SQL Server. These days, without a doubt I would now say: PhotoShop, Dreamweaver, Flash, ActionScript 3, Drupal, PHP, CSS, xHTML, XML and Design. In the world of tech, that is like agreeing to fight with the English and just before impaling William Wallace on your sword, shaking his hand and joining his team along with the other defecting Irish (not that I am Irish... I am Scottish!)

So I am geeked about the future of my career. I am 36 years young and feel like I am just getting started.

Tuesday, August 11, 2009

Forgot My Drupal Password

From time to time I use a web content management solution called Drupal to build websites. Drupal (pronounced Droop-pull) let's you build websites that are secure, that allow you to write articles and blogs with ease and basically manage the content of your website. Sometimes the trouble with Drupal is that it makes web development too easy.

Having said that there is one problem I keep bumping into with Drupal. Often times I will be setting up a site, and then I get side tracked and need to come back around later only to have forgotten the administrative password. Ugh! In a real implementation for Drupal, that would never be a problem. If you forgot your password, Drupal has the capability (out of the "box") to send an email message to the email associated with the a user so that user can reset their password. The problem is, if the site is in development and running locally, sometimes the email feature of Drupal doesn't get configured basically breaking the ability of Drupal to send that email and start the password reset process. Here is a work around for that!

On a local installation you probably have access to your MySQL database for the Drupal site. This is not typically something that someone on a live site would have access to, so this is a safe procedure. Drupal also protects against SQL Injection so what I am about to show you is pretty darned safe.

Go to your MySQL Database for the Drupal site using a tool like MySQLAdmin. Now, find the "user" table and "browse" it. Notice that you can see the user names in the table. At the same time notice that the passwords saved in the "pass" column seem encrypted. That is because, well, they are. Specifically they are encrypted using the MD5 algorythm. Now, if you know anything about MD5 or security then you know that the MD5 algorithm has been cracked. In reality, while this is true, you pretty much have to be super-human to hack MD5 encrypted messages so there really isn't anything to wory about.

So, how do we figure out this encrypted password? We don't. The trick is to simply change the password. Assuming that the password you want to change is associated with the user id "1" (the field or column should be called "uid") open up your MySQLAdmin "SQL" tab and run the following SQL:

UPDATE users SET pass = MD5('newpassword') WHERE uid = 1

...and that should result in telling you that one record was updated.

Now go back to your Drupal site and attempt to login with your new password. Easy, Peasy, Lemon Squeezy!