Monday, March 31, 2008

Free Useful Tutorials

-------------------------------------------------------------------------------------------------
Free Adobe Photoshop Tutorials
Here you'll find project-based curriculum to learn essential design concepts with Adobe Photoshop.

-------------------------------------------------------------------------------------------------
PHP Tutorials
PHP lets programmers create web pages with dynamic content that can interact with databases. In this way, it helps makes web pages more interactive, thus improving the user experience.
-------------------------------------------------------------------------------------------------
Free MS-PowerPoint Tutorials
PowerPoint is a complete presentation graphics package. It gives you everything you need to produce a professional-looking presentation. PowerPoint offers word processing, outlining, drawing, graphing, and presentation management tools, all designed to be easy to use and learn to help you create stunning presentations.
-------------------------------------------------------------------------------------------------
Free MS-Word Tutorials
Microsoft Office Word is a sophisticated word processing program that helps you quickly and efficiently create and format all the business and personal documents you need.

-------------------------------------------------------------------------------------------------
Free MS-Excel Tutorials
Microsoft Excel is the most popular and powerful spreadsheet program in the world. Learn the basics and advanced tutorials at your own pace. You will find many useful examples, tips and tricks.
-------------------------------------------------------------------------------------------------

Free Adobe Photoshop Tutorials


Welcome to Photoshop CS3
In this tutorial you will find out basic about Photoshop CS3.

A Plan for Nondestructive Workflow (Digital Photograph Expert Technique
This tutorial gives you an abbreviated overview of the workflow around. It is a sort of quick guide. Learn about Digital Photography Expert Techniques....

Welcome to Photoshop CS3

In this tutorial you will find out basic about Photoshop CS3.

Welcome to Photoshop
Exploring Adobe Photoshop
Viewing Photoshop’s Parts and Processes

Welcome to Photoshop

Adobe Photoshop is, without question, the leading image-editing program in the world. Photoshop has even become somewhat of a cultural icon. It’s not uncommon to hear Photoshop used as a verb, and you’ll even see references to Photoshop in the daily comics and cartoon strips. And now you’re part of this whole gigantic phenomenon called Photoshop.

Whether you’re new to Photoshop, upgrading from Photoshop CS2 or earlier, or transitioning from Elements to the full version of Photoshop CS3 or Photoshop CS3 Extended, you’re in for some treats. Photoshop CS3 has some intriguing new capabilities that enable you to do more, and more easily, than ever. Before we take you on this journey through the intricacies of Photoshop, we want to introduce you to Photoshop in a more general way. In this tutorial, we tell you what Photoshop is designed to do, what it can do (although not as capably as job-specific software), and what you can get it to do if you try really, really hard. I also review some basic computer operation concepts and point out a couple of places where Photoshop is a little different than most other programs. At the end of the chapter, we have a few tips for you on installing Photoshop to ensure that it runs properly.

Exploring Adobe Photoshop

Photoshop is used for an incredible range of projects, from editing and correcting digital photos to preparing images for magazines and newspapers to creating graphics for the Web. You can also find Photoshop in the forensics departments of law-enforcement agencies, scientific labs and research facilities, and dental and medical offices, as well as in classrooms, offices, studios, and homes around the world. As the Help Desk Director for the National Association of Photoshop Professionals (NAPP), I solve problems and provide solutions for Photoshop users from every corner of the computer graphics field and from every corner of the world. People are doing some pretty amazing things with Photoshop, many of which are so far from the program’s original roots that it boggles the mind!

What Photoshop is designed to do

Adobe Photoshop is an image-editing program. It’s designed to help you edit images — digital or digitized images, photographs, and otherwise. This is the core purpose of Photoshop. Over the years, Photoshop has grown and developed, adding features that supplement its basic operations. But at its heart, Photoshop is an image editor. At its most basic, Photoshop’s workflow goes something like this: You take a picture, you edit the picture, and you print the picture.

Basic Photoshop: Take photo, edit photo, print photo. Drink coffee (optional).

Whether captured with a digital camera, scanned into the computer, or created from scratch in Photoshop, your artwork consists of tiny squares of color, which are picture elements called pixels. Photoshop is all about changing and adjusting the colors of those pixels — collectively, in groups, or one at a time — to make your artwork look precisely how you want it to look. (Photoshop, by the way, has no Good Taste or Quality Art filter. It’s up to you to decide what suits your artistic or personal vision and what meets your professional requirements.) Some very common Photoshop image-editing tasks are: namely, correcting red-eye and minimizing wrinkles and compositing images.

Some common Photoshop tasks.

New in Photoshop CS3 is the powerful Black and White adjustment (found in the Image => Adjustments menu). Used to convert the appearance of a color image to that of a black and white (or grayscale) photo, it lets you blend the content of the various component colors to achieve a perfect grayscale image. See Figure, you also have the option of creating a sepia or tinted version of the image.

The Black and White adjustment gives incredible control over grayscale and tinted conversions.

Photoshop CS3 and Photoshop CS3 Extended

Although there have been different versions of “Photoshop” for years (Photoshop versus Photoshop LE versus Photoshop Elements), this is the first time that Adobe has marketed two different versions of Photoshopitself. Photoshop CS3 and Photoshop CS3 Extended both have all of Photoshop’s powerful image-editing, vectordrawing, painting, and type capabilities. Photoshop CS3 Extended also includes some very specialized, highly technical features for use in science, research, and video editing, and for use with 3D modeling programs. So, if you have Photoshop CS3 rather than Photoshop CS3 Extended, should you feel cheated or like a second-class citizen? Nope! Unless you specifically need those extended features, there’s no real reason to purchase them. But what if you got Photoshop CS3 Extended as part of a Creative Suite or Adobe Bundle package of software — did you pay for something you don’t need? Well, sort-of-yeahbut- not-really. The folks who’re really paying extra for the extended features are those who purchase Photoshop CS3 Extended as a standalone program. The additional cost they pay funds the research and development of the extended features.

Over the past few updates, Photoshop has developed some rather powerful illustration capabilities to go with its digital-imaging power. Although Photoshop is still no substitute for Adobe Illustrator, Photoshop certainly can serve you well for smaller illustration projects. (Keep in mind that Photoshop is a raster art program — it works with pixels — and vector artwork is only simulated in Photoshop.) Photoshop also has a very capable brush engine, which makes it feasible to paint efficiently on your digital canvas. Figure shows a comparison of raster artwork (the digital photo, left), vector artwork (the illustration, center), and digital painting (right). The three types of artwork can appear in a single image, too.

Photoshop CS3 includes some basic features for creating Web graphics, including slicing and animations (but Web work is best done in a true Webdevelopment program, such as Dreamweaver). Photoshop even includes special Web Photo Gallery features to help you create an entire Web site to display your artwork, and a PDF Presentation feature to prepare on-screen presentations, complete with transition effects between slides.


You can use Photoshop with raster images, vector artwork, and even to paint.

Other things you can do with Photoshop

Although Photoshop isn’t a page layout or illustration program, you certainly can produce simple brochures, posters, greeting cards, and the like using only Photoshop. One of the features that sets Photoshop apart from basic image editors is its powerful type engine, which can add, edit, format, and stylize text as capably as many word-processing programs. Photoshop even has a spell-check feature - not bad for a program that’s designed to work with photos.

You can use Photoshop to create cards, posters, and brochures.

Photoshop CS3 takes yet another giant step with the introduction of Smart Filters. Smart Filters, which are applied to Photoshop’s Smart Objects, are the long-awaited answer to the prayers of many in the creative world: re-editable filters! In the past, you applied a filter to a copy of an image and, if you changed your mind about what settings to use, you had to undo all subsequent work or (gasp! ) start from scratch. Smart Filters enable you to change your mind and simply re-open the filter’s dialog box and apply different settings to change your image enhancements or special effects. What a time (and project) saver.

Even if you don’t have the high-end video features found in Photoshop CS3 Extended, you can certainly supplement your video-editing program with Photoshop CS3 (even if Photoshop can’t open and play movies you capture with your video camera). From Adobe Premiere (or other professional video programs), you can export a series of frames in the FilmStrip format, which you can open and edit in Photoshop.

If you don't have specialized software

Admittedly, Photoshop CS3 just plain can’t do some things. It won’t make you a good cup of coffee. It can’t press your trousers. It doesn’t vacuum under the couch. It isn’t even a substitute for iTunes, Microsoft Excel, or Netscape Navigator — it just doesn’t do those things.

However, there are a number of things for which Photoshop isn’t designed that you can do in a pinch. If you don’t have InDesign, you can still lay out the pages of a newsletter, magazine, or even a book, one page at a time. (With PDF Presentation, you can even generate a multipage PDF document from your individual pages.) If you don’t have Dreamweaver or GoLive, you can use Photoshop to create a Web site, one page at a time, sliced and optimized and even with animated GIFs. You also have tools that you can use to simulate 3D in Photoshop CS3, such as Vanishing Point.

Page layout in Photoshop isn’t particularly difficult for a one-page piece or even a trifold brochure. Photoshop has a quite-capable type engine, considering the program is designed to push pixels rather than play with paragraphs. Photoshop even shows you a sample of each typeface in the Font menu. Choose from five sizes of preview (see in Figure) in Photoshop’s Preferences => Type menu. However, you can’t link Photoshop’s type containers, so a substantial addition or subtraction at the top of the first column requires manually recomposing all following columns. After all, among the biggest advantages of a dedicated page layout program are the continuity (using a master page or layout) and flow from page to page. If you work with layout regularly, use InDesign.

Now in Photoshop CS3: Five sample font sizes!

with Photoshop. However, if you don’t have Dreamweaver and you desperately need to create a Web page, Photoshop comes to your rescue. After laying out your page and creating your slices, use the Save for Web and Devices command to generate an HTML document (your Web page) and a folder filled with the images that form the page (see Figure). One of the advantages to creating a Web page in Dreamweaver rather than Photoshop is HTML text. (Using Photoshop, all the text on your Web pages is saved as graphic files. HTML text not only produces smaller Web pages for faster download, but it’s resizable in the Web browser.)

You can create an entire Web page in Photoshop.

Viewing Photoshop’s Parts and Processes

In many respects, Photoshop CS3 is just another computer program - you launch the program, open files, save files, and quit the program quite normally. Many common functions have common keyboard shortcuts. You enlarge, shrink, minimize, and close windows as you do in other programs.

Reviewing basic computer operations

Photoshop-specific aspects of working with floating palettes, menus and submenus, and tools from the Options bar, but we want to take just a little time to review some fundamental computer concepts.

Launching Photoshop

You can launch Photoshop (start the program) by double-clicking an image file or through the Applications folder (Mac) or the Start menu (Windows). Mac users can drag the Photoshop program icon (the actual program itself) to the Dock to make it available for one-click startup. You can find the file named Adobe Photoshop CS3 inside the Adobe Photoshop CS3 folder, inside the main Applications folder.

Never open an image into Photoshop from removable media (CD, DVD, your digital camera or its Flash card, Zip disks, jump drives, and the like) or from a network drive. Always copy the file to a local hard drive, open from that drive, save back to the drive, and then copy the file to its next destination. You can open from internal hard drives or external hard drives, but to avoid the risk of losing your work (or the entire image file) because of a problem reading from or writing to removable media always copy to a local hard drive.

Working with images

Within Photoshop, you work with individual image files. Each image is recorded on the hard drive in a specific file format. Photoshop opens just about any image consisting of pixels as well as some file formats that do not. Remember that to change a file’s format, you open the file in Photoshop and use the Save As command to create a new file. And, although theoretically not always necessary on the Mac, I suggest that you always include the file extension at the end of the filename. If Photoshop won’t open an image, it might be in a file format that Photoshop can’t read. It cannot, for example, open an Excel spreadsheet or a Microsoft Word DOC file because those aren’t image formats — and Photoshop is, as you know, an image-editing program. If you have a brand-new digital camera and Photoshop won’t open its Raw images, check for an update to the Adobe Camera Raw plug-in at

www.adobe.com/products/photoshop/cameraraw.html

You will find installation instructions for the update there. (Make sure to read and follow the installation instructions exactly.)

Saving your files

You must use the Save or Save As command to preserve changes to your images. And after you save and close an image, those changes are irreversible. When working with an important image, consider these three tips:

Work on a copy of the image file. Unless you’re working with a digital photo in the Raw format, make a copy of your image file as a backup before changing it in Photoshop. The backup ensures that should something go horribly wrong, you can start over. (You never actually change a Raw photo — Photoshop can’t rewrite the original file — so you’re always, in effect, working on a copy.)

Open as a Smart Object. Rather than choosing File => Open, make it a habit to choose File => Open As Smart Object. When working with Smart Objects, you can scale or transform multiple times without continually degrading the image quality, and you can work with Smart Filters, too!

Save your work as PSD, too. Especially if your image has layers, save it in Photoshop’s PSD file format (complete with all the layers) before using Save As to create a final copy in another format. If you don’t save a copy with layers, going back to make one little change can cost hours of work.

If you attempt to close an image or quit Photoshop without saving your work first, you get a gentle reminder asking whether you want to save, close without saving, or cancel the close/quit.

Keyboard shortcuts

Keyboard shortcuts are customizable in Photoshop, but some of the basic shortcuts are the same as those you use in other programs. You open, copy, paste, save, close, and quit just as you do in Microsoft Word, your e-mail program, and just about any other software. We suggest that you keep these shortcuts unchanged, even if you do some other shortcut customization.

Photoshop’s incredible selective Undo

Here’s one major difference between Photoshop and other programs. Almost all programs have some form of Undo, enabling you to reverse the most recent command or action (or mistake). Like many programs, Photoshop uses the Ctrl+Z shortcut for Undo/Redo and the Ctrl+ Alt+Z shortcut for Step Backward, which allows you to undo a series of steps (but remember that you can change those shortcuts). Photoshop also has, however, a couple of great features that let you partially undo.

Painting to undo with the History Brush

You can use Photoshop’s History Brush to partially undo just about any filter, adjustment, or tool by painting. You select the History Brush, choose a history state (a stage in the image development) to which you want to revert, and then paint over areas of the image that you want to change back to the earlier state.

You can undo as far back in the editing process as you want, with a couple of limitations: The History palette (where you select the state to which you want to revert) holds only a limited number of history states. In the Photoshop Preferences => General pane, you can specify how many states you want Photoshop to remember (to a maximum of 1,000). Keep in mind that storing lots of history states takes up computer memory that you might need for processing filters and adjustments. That can slow things down. The default of 20 history states is good for most projects, but when using painting tools or other procedures that involve lots of repetitive steps (such as touching up with the Dodge, Burn, or Clone Stamp tools), a larger number (perhaps as high as 60) is generally a better idea.

The second limitation is pixel dimensions. If you make changes to the image’s actual size (in pixels) with the Crop tool or the Image Size or Canvas Size commands, you cannot revert to prior steps with the History Brush. You can choose as a source any history state that comes after the image’s pixel dimensions change but none that come before.

Here’s one example of using the History Brush as a creative tool. You open a copy of a photograph in Photoshop. You edit as necessary. You use the Black and White adjustment on the image to make it appear to be grayscale. In the History palette, you click in the left column next to the step immediately prior to Black and White to designate that as the source state, the appearance of the image to which you want to revert. You select the History Brush and paint over specific areas of the image to return them to the original (color) appearance. There you have it — a grayscale image with areas of color, compliments of the History Brush.

Painting to undo with the History Brush.

Reducing to undo with the Fade command

Immediately after applying a filter or adjustment or using most of Photoshop’s tools, you can choose Edit => Fade and change the opacity or blending mode with which the previous step was performed. You might, for example, apply a sharpening filter and then choose Edit => Fade Unsharp Mask to change the blending mode from Normal to Luminosity. (Sharpening only the luminosity of your image, whether with this technique or in the Lab color mode, prevents unwanted color shifts along edges in your images. You might apply the Motion Blur filter and then choose Edit => Fade Motion Blur (yes, the name of the command actually changes for you) to reduce the opacity of the blur to 75%. That gives you the appearance of a backand-forth motion while leaving the subject more readily recognizable.

Compare the original blur with a reduction using the Fade command.

Installing Photoshop: Need to know

If you haven’t yet installed Photoshop CS3 (or the Adobe Creative Suite), here are a few points to keep in mind:

Install only into the default location. Photoshop is a resource-intensive program. Installing it into the default location ([harddrive] => Applications on a Mac and C:\Program Files for Windows) ensures that it has access to the operating system and hardware as necessary. Installing into any other location or attempting to run Photoshop across a network can lead to frustrating problems and loss of work in progress.

Disable all spyware and antivirus software before installing. Antivirus software can intercept certain installation procedures, deeming them to be hazardous to your computer’s health. That can lead to malfunctions, crashes, lost work, frustration, and what we like to call Computer Flying Across Room Syndrome. If you use antivirus software (and if you use Windows, you’d better!), turn it off before installing any program, especially one as complex as Photoshop. You might find the antivirus program’s icon in the Windows taskbar; or you might need to go to the Start menu, use All Programs to locate the antivirus software, and disable it. On Mac, check the Dock. And don’t forget to restart your antivirus software afterward! If you already installed Photoshop and antivirus software was running at the time, we urge you to uninstall and reinstall. (Reinsert the Photoshop CS3 CD and launch the installer to use the built-in uninstall feature.)

If you use autobackup software, shut it down, too. Never run autobackup software when installing software. Like antivirus software, it can also lead to problems by interfering with the installer.

Connect to the Internet and activate right away. It’s best to run the Photoshop installer while your computer is connected to the Internet. That enables Photoshop’s activation process to happen right away, making sure you can get started as soon as the installer finishes.

If you have third-party plug-ins, install them elsewhere.Third-party plug-ins — those filters and other Photoshop add-ons that you buy from companies other than Adobe — can be installed into a folder outside the Photoshop folder. You can then make an alias (Mac) or shortcut (Windows) to that folder and drag the alias/shortcut to Photoshop’s Plug-Ins folder. (If you have a multibutton mouse, right-click the folder to create an alias/shortcut; Control+click if you’re still using a one-button mouse.) Why install outside the Photoshop folder? Should you ever need to (gasp!) reinstall Photoshop, you won’t need to reinstall all your third-party plug-ins. Just create a new alias/shortcut and move it into Photoshop’s new Plug-Ins folder.

Check for plug-in updates. Go to the manufacturer’s Web site for each of your third-party plug-ins and check for updates. This is especially important if you’re using an Intel-based Mac. Unless the plug-ins have been updated (“Universal”), they won’t run. There’s a workaround, however. In the Finder, go to [harddrive] => Applications => Adobe Photoshop CS3. Right-click or Control+click on the program icon and choose Get Info. In the Get Info window, select the option Open Using Rosetta. Photoshop will run more slowly, but you’ll have your unupdated third-party plug-ins available. When the plug-ins are finally updated (or you decide speed is more important), reopen Get Info and deselect the Open using Rosetta check box.

If you have lots of plug-ins, create sets. Plug-ins require RAM (computer memory that Photoshop uses to process your editing commands). If you have lots of plug-ins, consider dividing them into groups according to how and when you use them. Sort (or install) them into separate folders. (Hint: Plug-ins that you use in many situations can be installed into multiple folders.) When you need to load a specific set, do so through the Photoshop Preferences => Plug-Ins pane by designating a second plug-ins folder and relaunching Photoshop.

If you love fonts, use a font-management utility. If you have hundreds of fonts (over the years, I’ve somehow managed to collect upward of 4,000 fonts), use a font-management utility to create sets of fonts according to style and activate only those sets that you need at any given time. Too many active fonts can choke the Photoshop type engine, slowing performance. The Mac OS has Font Book built right in, or you can use the excellent Suitcase Fusion from Extensis (www.extensis.com). Extensis also offers Suitcase for Windows.

A Plan for Nondestructive Workflow (Digital Photography Expert Technique)

This tutorial gives you an abbreviated overview of the workflow around. It is a sort of quick guide.


Getting the Camera Ready
Computer Equipment and Configuration
Image Downloading
Winnowing Your Shoot
Backing Up Originals
Presentation for Client Approval
Preliminary Editing
Final Output

Getting the Camera Ready

We have listed a few key thoughts about how to have your camera ready to create the best input data for the rest of the process:

Note:

Many pros like carrying a compact camera as a second or third camera. You can be assured of having it with you all the time, it makes it easier to shoot from extremely low or high angles, and it is especially well-suited to macrophotography (extreme closeups) due to the greatly extended depth-of-field afforded by their tiny sensors.

  • Keep your basic lens on the camera unless you know you are about to shoot a special situation. For instance, if you normally do photojournalistic work, you will probably want to keep the 35mm equivalent of a 28120mm lens on the camera.

  • Always keep a strap on each camera and wear the camera you use the most around your neck, ready to shoot. Then all you have to do when the moment comes is "ready, aim, fire." If a passerby bumps you and the camera flies out of your hands (or someone tries to steal it), it stays around your neck.

  • Neutralize the camera settings. That is, set them so that you're most likely to be ready for what happens next. If you have to shoot JPEGs, turn off all the settings that cause the camera to preprocess the photo: color balance, saturation, and special effects (such as sepia or infrared), and situational settings (sun, shade, snow, portrait, etc.). You can always turn them on when you need them.

  • Most cameras give you the choice of naming all files in sequence or restarting the sequence each time you change a card. Make certain that this setting always stays at the default of naming all files in sequence.

  • We like to keep my camera set for sequence shooting. If there is fast action going on, we more likely to catch the peak moment. If there is any doubt about whether the camera will be steady enough to ensure a sharp shot, shooting a sequence makes it likely that one or two of the shots will be sharper than the others. Remember, there is no such thing as wasted film in digital. You just delete whatever doesn't work out.

  • It is a good idea to carry two camera bodies. I often use a full-frame body and back it up with a slightly less expensive DSLR. On the other hand, if your base camera is relatively affordable it's worth considering simply buying two of them. Any pro will tell you that the only time your camera breaks down is when you can least afford it. You are on the vacation or assignment of a lifetime when a donkey kicks the tripod and knocks it off an 800-foot cliff.

  • Don't change lenses when there is visible moisture, dust, smoke, or other "stuff" in the air. No, not even if your camera has a built-in dust remover. It is possible to over-power any technology. If you don't have a proper sensor cleaning kit, then you're definitely going to spend hours retouching the same spot on hundreds of frames. The best plan, whenever possible, is to take along a pair of bodies. Put a long zoom on one and a wide-angle zoom on the otheror whatever two focal lengths you are most likely to need. Having two bodies with different lenses also makes it faster to switch focal lengths. Or get one of the new 18200mm zoom lenses being offered by many manufacturers.

  • Because you are bound to change lenses sooner or later, be sure to take along a sensor-cleaning kit. Do not even think about trying to clean your sensor with lens-cleaning spray, cotton swabs, or blower brushes. Those are all good items to keep handy for lens and body cleaning, but they will ruin your sensor. There are many sensor-cleaning kits on the market and it seems like a new one is introduced every week.

Computer Equipment and Configuration

Today's images are getting bigger and better than ever. If you were used to shooting 5 MP JPEGs and then jumped to the 8 MP RAW files that some of today's $900 DSLRs shoot, your file size will increase from about 1.5 MP to between 5.5 MP (saved to DNG) and 8 MP (Canon CR2 file in 16-bits [only 12-bit of image data] for 8 MP image). Once you've processed that file according to the recommendations in this tutorial, you will have between 5 and 15 layers and several will be image layers. You could easily end up with 100 MB files for all your best imagesthat is, the ones you have the incentive to really put some effort into processing to perfection. For example, last year we shot some 8,000 images in CR2 format. Let's say the toss-out rate is about 15 percent. That still leaves 6,800 images we have to store and find. We have used only about 54 gigabytes of storage so far. If about 10 percent graduate to stardom, that is only 680 images. The problem is, each image is going to need about 100 MB of space by the time we finish editing them nondestructively. So we need another 54 GB for the special 10 percent that survive. You begin to see the problem when you realize that a lot of pros shoot at least 10 times as many images as we do.

The bottom line is that you need to start with a very fast computer with lots of storage. For either Windows or Mac, we suggest a dual core or 64-bit processor running at around 2.4+ gigahertz. Plug at least 1 MB of RAM into the motherboard and move up to 2+ MB as quickly as you can afford it.

Every time you see a sale on 250500 GB external hard drives, get yourself another. External drives make the most sense for storing large image libraries. They are easy to copy to one another for backup and they can easily be moved from computer-to-computer. At sale prices, you will pay around 75 cents per gigabyte or $180 for a 250 GB drive. Make backups by copying one drive to another while you're sleeping. External hard drives love to crasha much unpublicized factand you don't dare risk your valuable images. Be very careful to follow the prescribed routines for installing the software for the drives, plugging them in and out, and turning them on and off.

When it comes to your ability to see your images clearly so you can judge them accurately, you will want to pay attention to your video system. You want a high-performance video card. The NVIDIA GeForce, ATI Radeon, and Matrox are presently considered best-in-class. Check out current web reviews and information for what is considered state-of-the-art. (You don't need the top of the line cards that are intended for the gamers market.)

It is also time to move up to a state-of-the-art flat-panel screen unless you are doing pre-press work in a production house. There are now excellent 19-inch models on the market for less than $300. Look for a model with a contrast ratio better than 500:1 (the higher the contrast ratio, the better) and the widest possible viewing angle. Most of us will gladly trade a tiny margin of brightness and contrast ratio for a steadier image that is much easier on the eyes and has virtually no screen glare. Besides, you need the extra room on your desk for a Wacom graphics tablet and all those hard drives.

Given the resolution that pros are expecting from their images, we would not even consider a screen size smaller than 19 inches. If you have an older 17-inch monitor, consider getting a dual monitor video card and using the second monitor strictly for menus, Bridge, or DAM software.

Speaking of image backup, do not even think about anything less than a state-of-the-art DVD writer8X write speed minimum. CDs just are not capacious enough for contemporary files, and you have to spend way too much of your time swapping disks when they fill. Do not write on the disks with Sharpie markers or paste labels on them. Instead, go to your local office supply store and ask for acid-free markers. They look just like Sharpies, cost a bit more, but won't send your images to heaven when you least expect it.

If you travel or hike while shooting, a high-horsepower laptop is a lifesaver. Look for the following features: 1+ MB RAM, 100+ GB HD, 15.4- or 17-inch widescreen, DVD writer, built-in WiFi, and built-in card reader. Even a duo-core 64-bit processor is an affordable option nowadays. You should be able to get all this for around $1,200 in a Windows laptop or for around $2,200 in a Mac laptop.

Image Downloading

One of the most critical points in an efficient workflow is the disciplined process by which you get your pictures from camera to computer. You want to combine downloading with both an efficient and effective naming process and a disciplined and regular means for backing up. As a part of this process, you want to get rid of anything that might be embarrassing to you, your client, or your model. Never was the phrase "out of sight, out of mind" more appropriate than when winnowing out the crap. The difference between an average photographer and a great one is that the great ones know what to throw away. Then, you want to immediately get your images to your client in a professional-looking presentation that makes you look as good as possible. Generally speaking, the more pictures the client likes, the more you will get paid, and the more often you will be asked to shoot again.

Downloading Alternatives

There are several devices you can use to download your images from camera to computer. First, most all digital cameras, and certainly all DSLRs, have either a USB or FireWire port that allows you to connect your camera directly to your computer. Second, you can buy a card adapter that plugs into either a USB or FireWire port. Finally, there are computers that have card readers built into them.

It won't do much good for me to tell you which downloading device to use, because there are too many variables between devices, card speed, and internal computer circuitry to make that opinion meaningful. However, we will tell you that download speed is important. We have seen a difference of a minute and a half to 12 minutes just to download the same images from the same card through different devices to different computers. My advice to you: get or borrow all three types of devices, take them home, and test them with a stopwatch. A state-of-the-art digital card reader only costs about $25 these days, and spares come in handy if you are traveling without a computer or have to loan one to a client or friend. Actually, you will need one if you have a Mac. Macs are not available with built-in card readers! Anyway, back to reality: Put your card filled with photos into each device and clock the download time for that card in that device. Put your camera in sequence shooting mode and fill a card with images. Then, download that card's images through an internal card reader, a USB 2.0 card reader, and (if you have a FireWire port) through a FireWire card reader. Make sure you download from the same card each time; that way, you know that it is not the speed of the card that is influencing your decision. Now you know which download device is fastest. Regardless of the speed of the card itself, the device that downloads that card fastest will download any card of any speed faster than the other devices you tested.

NOTE:

The speed designations that manufacturers give their cards are only useful as a guideline. One maker's 4X card is not necessarily the same as another's. Borrow several brands and speeds, fill each with photos, and test them for yourself. It is easy to test download times for the cards.

All things being equal, we are in favor of the convenience of built-in, front-mounted card readers. They are always where you can reach them easily, don't require any operating expertise, can be used while you are camera is shooting something else, and require no software expertise. Plug a card into the appropriate slot (it won't fit if it is not the right slot). Immediately, a new drive will appear on your desktop (Mac) or in My Computer (Windows). Read the files and do with them just as you would files in any other directory on your computer.

Storing the Files

Be sure to store all the files from a shoot in the same folder. Name that folder after the most broadly applicable name you can give to the shoot. If it is personal, we name it after the person or place where we did the shoot. Occasionally, an entire shoot consists of a study of one subject. In that case, we name the folder after the subject. If the subject is something like a road trip, we name the folder after the farthest or most memorable destination. If it is a commercial shoot, we name it after the purpose of the shootnever after the client. There are a couple of reasons for that: some of the photos may end up being sold to a variety of clients, and we may have folder after folder for the same client, many of which can contain very different subject matter. The point is that you want to name your folders so that you are most likely to know what they contain. You won't always be right, but you will be right more often than not.

The first part of the folder name is the six-character date of the shoot organized by year, month, day for instance, 060224. We don't use dashes or slashes or characters that are illegal in filenames. Here are some typical folder names:

060912 Lydia furs
051227 Morgan Hill
050612 Smith Wed
050707 Small Town Stock

Back up RAW files to DVD

Up until now, the workflow procedure has been the same for both RAW and JPEG. At this point, however, you want to convert your proprietary RAW files to a more archival and universal RAW file format called Adobe DNG. If you shot JPEG, skip the backup procedure here and move on to the sections about naming and winnowing files.

NOTE:

A few high-resolution digital camera backs (and possibly some upcoming Canon cameras according to current rumors) will shoot their RAW files in DNG format. If that is the case, you obviously needn't concern yourself with the procedures in this section.

For the rest of you, as soon as you have downloaded your RAW files and put them into folders, back up those files to DVD. If you don't have a DVD burner, get a 16X dual-layer, read and read-write (R+RW) DVD burner or Apple Super Drive. If you want to install a new one internally, you will save desktop real estate. If you already have a DVD recorder but want a faster and more capable one, keep both. Then you can easily copy CDs and DVDs directly from one drive to another without having to recopy them. That will be a big timesaver when you need to copy DVDs every three to five years to avoid their untimely demise.

Be sure to get some name-brand DVDs. Don't buy those no-name or store-name bargain-priced disks. With rare exceptions, you will end up throwing away a huge percentage just because you can't write to them. When they do work, don't be surprised if you pop one in the drive a few days or weeks later, only to find that the computer can't read it.

Converting to DNG

As we just mentioned, there is one nonproprietary RAW format that belongs to us all, even though it was invented by Adobe. It's called DNGshort for "digital negative." It has more features than proprietary RAW files and may eventually become a universal format. Any future version of this format is promised to be backward compatible with older versions, so it is unlikely that your files will be orphaned by the discontinuance of their format. Furthermore, you can rest assured that virtually all image editing software invented or updated since late 2005 will be compatible with DNG files. DNG files can even be read now as thumbnails by your operating system's file browser, provided you have updated your system.

If you have not already downloaded the DNG converter from the Adobe site, do it now. It is a small utility that installs on your system's desktop and does not cost a penny.

Here is the routine:

  1. Install the Adobe DNG converter according to the instructions that come with the download. (In Windows, the installer places a shortcut on your desktop by default.)

  2. Double-click the Adobe DNG Converter icon. The DNG Converter dialog will open. As you can see, the DNG Converter dialog is divided into four sections. The next steps show you the settings to use for each section. If your eyes (or magnifying glass) are good enough to decipher the small print in the figure, you can just use the same settings.

  3. In Section 1, click the Select Folder button. You will get a browser/finder-type dialog that lets you navigate to the folder where you just downloaded your images. At this stage, should you have any subfolders, they may not contain any RAW files. If that is the case, leave that box unchecked.

  4. In Section 2, click the Select Folder button. Another browser/finder dialog opens. Select the folder you downloaded your RAW files to, then click the Make New Folder button. A new folder icon will appear with the name New Folder highlighted. Overtype the New Folder name with the same name as the parent folder, but with .dng added to the end.

  5. In Section 3, you have a chance to put the appropriate prefix on the original filename. If all the images in this folder are of the same subject (often the case in a product or fashion shoot), then rename all the files so they are preceded by the subject's name. If that is the case, highlight Document Name and type over it with the name of the subject. Then, pull down the menu to the immediate right and choose Document Name. You need not do anything more, because the camera has already put all the filenames in a series. So there will never be a duplicate filenameunless you have multiple cameras that use the same naming convention. That is a pretty common occurrence for pros who are carrying multiple bodies of the same brand. If you do have multiple cameras with the same naming convention, put a sticker on the bottom of the camera with a letter on it. (Surely you don't have more than 26 of these cameras, but if you do, use double letters.) Now, if you have multiple sources for the same naming convention, type the letter(s) for the appropriate camera into the third field.

  6. Still in Section 3, make sure the File Extension menu choice is .dng.

  7. The chosen preferences should be Compressed (lossless) and Preserve RAW image (you can change either of these by clicking the Change Preferences... button). Don't embed the original (takes more space and you're about to back it up). If those are not the settings, just click the Change Preferences button and a dialog will appear that lets you specify the settings I have just specified. Is that specifically clear?

Here are the steps to complete the DNG backup routine:

  1. Open Bridge and drag the new DNG directory above the icon of its parent folder. This simply moves it.

  2. Insert a blank DVD or CD into your DVD drive. Your CD/DVD burning software opens. Hopefully, you have read the instructions and know how to use it. If not, you may want to download the manual from the company's web site.

  3. Drag the original folder into the data space in the CD/DVD burning dialog and click whatever buttons are necessary to make the backup CD or DVD (probably the latter, but why waste space if this was a short shoot?).

  4. When the disk has been burned, you should get a dialog telling you that the data has been successfully written to the disk. The disk usually auto-ejects, but if it doesn't, close the disk burning software and eject the disk.

  5. Reinsert the disk and open an image or two in Bridge to make sure the images are there and have not been corrupted. It will take longer to read all the files, but checking the thumbnails is a good way to make sure that none of your image data has been corrupted in the disk-writing process.

  6. Eject your disk, label it with the shoot's folder name using an acid-free marker, and store it in an acid-free CD album.

  7. Erase your original RAW files.

Send proprietary RAW files to CD and erase them from your drive. Now you have one backup that you are not likely to touch.

Winnowing Your Shoot

Photographers who are moving from film to digital are fast learning that they have to establish a whole new routine for what used to be called "initial editing." To distinguish it from the simple business of looking at slides and negatives on a light table and throwing out anything that is not worth keeping, that process has acquired a new trade name winnowing which encompasses the following:

Organizing and regrouping

Photos that are closely related or that show a time sequence should have their thumbnails moved next to one another. These days, that process is called Lightableing. You should do the same to all photos of the same subject that were shot in the same location, lighting condition, and cropping. This results in arranging photos into what we call sequences. You do this to automate the basic processing of whole groups of images at one time and to batch rename and add metadata to whole groups of files at one time.

Renaming

Once images have been grouped into sequences, you can use the Batch rename command to add an abbreviation that indicates the subject of that sequence, such as "red dress cu." You can then Batch rename the entire sequence.

Adding metadata

You will want to add metadata such as copyright information and descriptive keywords. Once entered, metadata stays with the file as it is copied and manipulated. This way it is easier to prove copyright or find and collect files that belong to a particular group or category.

Ranking the images

You are able to rank images with a star rating. It then becomes possible to show only those images that have a minimum or better ranking.

Backing Up Originals

This is the time to copy all the files you have named and ranked to external media so that you have the means to recover if something should happen to your original file. For the sake of speed and efficiency, we suggest you purchase and install an external hard drive and make your first copy to that drive. You should also have a second drive stored someplace away from your main property. At regular intervals (say twice a week), bring in the second drive and copy the contents of the first drive to it so that you end up with two identical hard drives full of data.

For the sake of portability, we also suggest that you immediately copy your originals to optical media. Not only do you have the added insurance of yet another backup, but you can take images with you if you want to work on a laptop on the road or need to make copies of files to send else where especially if you want to send your advanced processing to an outside facility.

Presentation for Client Approval

Once you have your images adjusted to the point where they are at least presentable to the client, you should be aware of a couple of further considerations. First, if it's a portrait, fashion, or product shoot, consider whether you can get away without retouching before you present. Second, you will have to decide how you are going to make the presentation. You didn't think Photoshop was going to give you only one choice.

Retouching for Client Approval

First, regarding retouching, there are two more problems: retouching can be destructive and, although there are ways to retouch nondestructively, they can't be done in Camera Raw. Then, of course, there is the fact that retouching can be one of the most time-consuming facets of image processing. Next, you have to realize that the glamorization of the subject is the whole point of the three disciplines of photography that we mentioned above: fashion (including glamour), portraiture, and product photography. You shouldn't present the image in less than its best form. That is a bummer, because otherwise you can simply create all the presentation formats directly from your RAW files. The compromise we make is to retouch the shot we had most like to see chosen and then make it clear in the presentation that this is how all the images in that series would look, should one of them be chosen. So we save that shot as a Photoshop file before we put the images into the presentation and use only the Healing and Clone tools that will put their retouching strokes on a blank layer.

On rare occasions, we may use other tools if it is the only way to sell the client, but even then retouching is all done on a copy of the main subject layer (usually the Background layer). So just remember that there is a very good chance you will want to delete this retouching later in the process and that you will have to do it all over again. It won't be as painful if you avoid doing any more than is necessary this early in the game.

Presentation Options

As we said, Photoshop CS2 gives you many options for presenting a shoot to the client. Most of these methods have other uses as well.

Contact Sheets:

Contact sheets have have the advantage of being very quick and easy for a client to physically mark the chosen images with a marker. Images are also automatically rotated to be vertical or horizontal, according to how they have been rotated in Bridge. Also, the images can be passed around for a committee vote without requiring each participant to have a computer. (Of course, these days, most anyone likely to be voting will have a computer.) Finally, you can email a JPEG of the finished contact sheet files and the client can then print as many copies as are needed to pass around the office.

Galleries:

Galleries are similar to the multiple-image Camera Raw view or the Slideshow mode of Bridge. That is, thumbnails of each image are shown on one side of the gallery, while a larger preview image appears on the other side whenever you click on a thumbnail.

Photoshop's built-in galleries, along with a few that are available from www.adobe.com, are the easiest to incorporate into your workflow. However, almost all image editing and image management programs also automatically create galleries from a folder and, generally speaking, the designs are all different from one another. We know photographers who have collected half a dozen or so third-party programs that they use primarily for creating galleries.

NOTE:

All the automatically created galleries are editable in any HTML editor. So if you don't like the style, you can always open the gallery in Adobe Go Live or Dreamweaver and redesign it interactively.

PDF presentations:

If you are still in love with the tradition of inviting the client over for a live slide show, this is the way to do it. The advantage is that the audience gets to chime in all at once and it's easy to have the conversation bounce around among art director(s), client reps, photographers, and assistants. The big downside is that there is no way to put the image's filename on screen so it can be noted. Furthermore, there is no equivalent to taking the slide out of the projector to give to the photographer as a sign of approval. The potential versatility of PDF documentsthey can be read on most computers and over the Internetholds a lot of promise. Unfortunately, the potential is limited. You'd be better off hooking up an LCD projector to your laptop and running a web gallery from a CD as a means of running a slide show.

Preliminary Editing

Now we come to the point in this tutorial where the workflow of Photoshop editing and manipulation begins to take place. There are two main stages in this workflow: Camera Raw and Photoshop.

Editing Stage 1: Camera Raw

Before you get into Photoshop, make sure you have done everything possible in Camera Raw to give yourself a good foundation. Remember, everything you do in Camera Raw is nondestructive, so you want to do as much as possible before you move on. You want to make your image look as gorgeous as you can in regard to color balance, dynamic range, cropping and leveling, lack of fringing and noise, and controlling contrast within specific ranges of Brightness with the new Curves tab.

If you don't mind spending the money and taking the time to work outside of Photoshop, you might want to do even more on your RAW files with a third-party application such as Phase One Capture One or Pixmantec Raw Shooter Premium.

Editing Stage 2: Photoshop CS2

As amazing as Camera Raw is, it just doesn't do everything you might want to do. Rather than list all the things it doesn't do, I will just list the things you will most likely want to do in the most constructive and efficient order:

Adjustment Layers:

Use to do overall image corrections on all the layers beneath that layer.

Masked Adjustment Layers:

Use when you want an adjustment to apply only to a preselected portion of the image.

Clipping Layers:

Use for an Adjustment Layer that affects only one layer below or selected layers. Masked layers can be clipped, too.

Merged Copy Layers:

Use for applying destructive processes, such as filters (including knockouts, filters, and destructive adjustments) and certain types of retouching. Destructive adjustments are those that don't work as adjustment layers and, therefore, make significant changes to the image when applied.

Transparent Layers

Use for retouching and compositing.

Duplicate the image when you must convert from 16-bit to 8-bit mode

That way, you can always go back to make changes in the 16-bit mode. Also, add "8b" to the end of the filename. You should assume that all the other images were output from Camera Raw to 16-bit mode, where you'd have the most adjustment latitude.

By following the steps above in order, you will easily locate the point where you made a revision to your image. Moreover, you are working from the place where the adjustment affects more of the overall image to the place where it affects less at least until you get past the point of using Adjustment Layers. You are basically turning off layers from the top down. When you get to the point where your image is free of any content or characteristics you don't want it to have, stop and start building new layers.

Now here is the really good part. You can keep the old layers, group them into a set or sets, and then turn off the set. Then, if you want to show yourself or an art director the difference between one version of the image and others, you just turn the layer sets on and off. This allows you to display whole ranges of interpretations of an image without ever having to change images.

Final Output

The very last stage of processing is to create your invaluable and nearly irreplaceable digital positive. First of all, calling it a negative is technically incorrect and, well, negative. Besides, we have gone well past the point where the image was RAW. You are now making a copy that can be flattened, sized, converted to a more universal format (such as JPEG or TIFF), and assigned the proper color profile for the destination reproduction vehicle. How you create that digital positive will depend on what your purpose is for any given version of a final output file: web, online media, offset printing, or output to a desktop printer. The process may also require switching Color Spaces and Color Management Profiles.

PHP Tutorials

What is PHP and Why Should I Care?
One of the first things most people want to know about PHP is what the initials stand for. Then they wish they had never asked. Officially, PHP stands for PHP: Hypertext Preprocessor.

Basics of Object Oriented Programming
This tutorial is aimed at an audience unfamiliar with the basic concepts of object-oriented programming (OOP). The intent is to provide a general overview of OOP with a view toward using PHP effectively.

Object Oriented Features New to PHP 5
Object Oriented Features New to PHP 5......a useful tutorial.

Introduction to XML and Web Services
The Extensible Markup Language (XML) is a simple, platform-independent standard for describing data within a structured format. XML is not a language but instead a metalanguage that allows you to create markup languages.

What is PHP and Why Should I Care?

One of the first things most people want to know about PHP is what the initials stand for. Then they wish they had never asked. Officially, PHP stands for PHP: Hypertext Preprocessor. It is an ugly name that gives the impression that it is strictly for nerds or propellerheads. Nothing could be further from the truth.

PHP is a scripting language that brings websites to life in the following ways:

* Sending feedback from your website directly to your mailbox

* Sending email with attachments

* Uploading files to a web page

* Watermarking images

* Generating thumbnails from larger images

* Displaying and updating information dynamically

* Using a database to display and store information

* Making websites searchable

* And much more . . .

PHP is easy to learn, it is platform-neutral, so the same code runs on Windows, Mac OS X, and Linux; and all the software you need to develop with PHP is open source and therefore free. There was a brief debate on the PHP General mailing list (http://news.php.net/ php.general) in early 2006 about changing what PHP stands for. Small wonder, then, that it drew the comment that people who use PHP are Positively Happy People.

PHP started out as Personal Home Page in 1995, but it was decided to change the name a couple of years later, as it was felt that Personal Home Page sounded like something for hobbyists, and did not do justice to the range of sophisticated features that had been added. Since then, PHP has developed even further, adding extensive support for objectoriented programming (OOP) in PHP 5. One of the language’s great attractions, though, is that it remains true to its roots. You can start writing useful scripts very quickly without the need to learn lots of theory, yet be confident in the knowledge that you are using a technology with the capability to develop industrial-strength applications. Although PHP supports OOP, it is not an object-oriented language.

Make no mistake, though. Using simple techniques does not mean the solutions you will find in these pages are not powerful. They are.


Embracing the power of code
How hard is PHP to use and learn?
How safe is PHP?

Embracing the power of code

If you are the sort of web designer or developer who uses a visual design tool, such as Dreamweaver, GoLive, or FrontPage, and never looks at the underlying code, it is time to rethink your approach. You are rapidly becoming an endangered species-and not the furry or cuddly sort that environmentalists will campaign to save from extinction. Good-looking design is definitely a top priority-and always will be-but it is no longer enough on its own. Designers need to have a solid grasp of the underlying structure of their pages. That means a knowledge of Hypertext Markup Language (HTML)-or its more recent incarnation, Extensible Hypertext Markup Language (XHTML)-and Cascading Style Sheets (CSS).

The CSS Zen Garden, cultivated by Dave Shea, played a pivotal role in convincing designers of the power of code. The underlying XHTML of every page showcased at www.csszengarden.com is identical, the CSS produces stunningly different results. You do not need to be a CSS superhero, but as long as you have a good understanding of the basics of XHTML and CSS, you are ready to take your web design skills to the next stage by adding PHP to your arsenal.

PHP is a server-side language. That means it runs on the web server, unlike CSS or JavaScript, which run on the client side (that is, the computer of the person visiting your site). This gives you much greater control. As long as the code works on your server, everyone receives the same output. You can do the same thing with JavaScript, but what visitors to your site actually see depends on two things: JavaScript being enabled in their web browser, and the browser they are using understanding the version of JavaScript you have used. With PHP, this does not matter, because the dynamic process takes place entirely on the server and creates the XHTML needed to display the page with a random choice of image. The server chooses the image filename and inserts it into the tag before sending the page to the browser. You can even use images of different sizes, because the PHP code detects the dimensions of the image and inserts the correct width and height attributes.

What PHP does is enable you to introduce logic into your web pages. This logic is based on alternatives. If it is Wednesday, show Wednesday’s TV schedules . . . If the person who logs in has administrator privileges, display the admin menu, otherwise, deny access . . . that sort of thing.

PHP bases some decisions on information that it gleans from the server: the date, the time, the day of the week, information held in the page’s URL, and so on. At other times, the decisions are based on user input, which PHP extracts from XHTML forms. As a result, you can create an infinite variety of output from a single script. For example, if you visit at http://foundationphp.com/blog/, and click various internal links, what you see is always the same page, but with different content.

How hard is PHP to use and learn?

PHP is not rocket science, but at the same time, do not expect to become an expert in five minutes. If you are a design-oriented person, you may find it takes time to get used to the way PHP is written. What we like about it very much is that it is succinct. For instance, in classic ASP, to display each word of a sentence on a separate line, you have to type out all this:

<%@ Language=VBScript %>

<% Option Explicit %>
<%
Dim strSentence, arrWords, strWord
strSentence = "ASP uses far more code to do the same as PHP"
arrWords = Split(strSentence, " ", -1, 1)
For Each strWord in arrWords
Response.Write(strWord)
Response.Write("
")
Next
%>

In PHP, it is simply

$sentence = 'ASP uses far more code to do the same as PHP';
$words = explode(' ', $sentence);
foreach ($words as $word) {
echo "$word
";
}
?>

That may not seem a big difference, but the extra typing gets very tiresome over a long script. PHP also makes it easy to recognize variables, because they always begin with $. Most of the functions have very intuitive names. For example, mysql_connect() connects you to a MySQL database. Even when the names look strange at first sight, you can often work out where they came from. In the preceding example, explode() “blows apart” text and converts it into an array of its component parts.

Perhaps the biggest shock to newcomers is that PHP is far less tolerant of mistakes than browsers are with XHTML. If you omit a closing tag in XHTML, most browsers will still render the page. If you omit a closing quote, semicolon, or brace in PHP, you will get an uncompromising error message. This is not just a feature of PHP, but of all server-side technologies, including ASP, ASP.NET, and ColdFusion. It is why you need to have a reasonable understanding of XHTML and CSS before embarking on PHP. If the underlying structure of your web pages is shaky to start with, your learning curve with PHP will be considerably steeper.

PHP is not like XHTML: you ca not choose from a range of PHP editors that generate all the code for you automatically. Dreamweaver does have considerable support for PHP, and it automates a lot of code generation, mainly for integrating web pages with the MySQL database.

How safe is PHP?

PHP is like the electricity or kitchen knives in your home: handled properly, it is very safe, handled irresponsibly, it can do a lot of damage. PHP is unsafe; nor does everyone need to become a security expert to use PHP. What is important is to understand the basic principle of PHP safety: always check user input before processing it. Most security risks can be eliminated with very little effort. The other important thing is to know enough about scripts that you are using, so that if a problem arises, you can implement any remedies suggested to you by the author of the script or another expert.

Basics of Object Oriented Programming

This tutorial is aimed at an audience unfamiliar with the basic concepts of object-oriented programming (OOP). The intent is to provide a general overview of OOP with a view toward using PHP effectively. We will restrict the discussion to a few basic concepts of OOP as it relates to PHP, though it is sometimes useful to look at other object-oriented (OO) languages such as Java or C++.

We will discuss three aspects of object orientation in this tutorials: class, access modifiers, and inheritance. Although OOP may be a different programming paradigm, in many respects it is an extension of procedural programming, so where appropriate, We will use examples from procedural programming to help explain these concepts.

Class
Objects Need Access Modifiers
Object Reuse and Inheritance

Class

You cannot have OOP without objects, and that is what classes provide. At the simplest level, a class is a data type. However, unlike primitive data types such as an integer, a float, or a character, a class is a complex, user-defined data type. A class is similar to a database record in that it encapsulates the characteristics of an object. For example, the record of a Person might contain a birth date, an address, a name, and a phone number. A class is a data type made up of other data types that together describe an object.

Classes Versus Records

Although a class is like a record, an important difference is that classes contain functions as well as different data types. And, when a function becomes part of a data type, procedural programming is turned on its head, quite literally, as you can see in the following example syntax. A function call that looked like this:


function_call($somevariable);

looks something like this with OOP:


$somevariable->function_call();

The significant difference here is that OO variables do not have things done to them, they do things. They are the actors rather than the acted upon, and for this reason they are said to behave. The behavior of a class is the sum of its functions.

A Cohesive Whole

Procedural programmers often work with code libraries. These libraries usually group related functions together. For instance, all database functions might be grouped together in a file called dbfunctions.inc. The functions that make up an object’s behavior should also be related to one another, but in a much stronger fashion than functions in the same library. Just as the different elements of a Person record describe an individual, so too should the behavior of a class describe the class. In order for something to be an object, it should be a cohesive whole incorporating appropriate characteristics and appropriate behavior.

Objects Are Instances

Classes are not themselves objects, but a way of creating objects-they are templates or blueprints that form the model for an object. When speaking loosely, these two terms are sometimes used interchangeably, but strictly speaking an object is an instance of a class. This is somewhat like the difference between the concept of an integer and a specific variable $X with a specific value. The concept of a class as a template for an object becomes clearer in the context of inheritance, especially when we discuss multiple inheritance (a topic we will deal with shortly).

Objects Need Access Modifiers

OOP is made possible by using this simple concept of a class as a cohesive aggregate of characteristics and behaviors, this is exactly what objects are in PHP 4—but one of the most important features of any OO language is the use of access modifiers. Access modifiers refine the object model by controlling how an object is used or reused. Simply put, access modifiers provide guidance about what you can and cannot do with an object. To get a sense of what this means, let’s use an example from procedural programming.

Let’s define a subroutine as a function that is never invoked directly but that is only called by other functions. Now suppose you are a procedural programmer with a library of functions and subroutines that is used by several other programmers. The ability to flag subroutines as secondary would be helpful in instructing others how to use your library, but the only way to do this is through documentation. However, in OOP, access modifiers not only indicate the primacy of certain functions over others, they enforce it programmatically. They implement language constraints to ensure that “subroutines” are never called directly. Properly constructed classes are self-documenting and self-regulating.

In the situation just described, the need to document a code library arises because it is used in a collaborative environment, the exact same circumstance accounts for the existence of access modifiers. One of the assumptions of OOP is that it is conducted within an interactive context with access modifiers defining the ways of interacting. This is one of the important differences between OOP and procedural programming. Access modifiers provide the rules for using a class and this syntactically defined “etiquette” is commonly referred to as an interface. By providing an interface, there is less need to rely on documentation and on user programmers “doing the right thing.”

Documenting code libraries is important because libraries get reusedl, access modifiers matter for exactly the same reason-they facilitate reuse.

Object Reuse and Inheritance

In a biological sense, a child inherits genes from its parents, and this genetic material conditions the appearance and behavior of the child. In OOP the meaning of inheritance is analogous-it is the ability to pass along characteristics and behavior. At first this feature of OOP may seem somehow magical, but really inheritance is just a technique for reusing code-much the way you might include a library of functions in procedural programming.

If you identify an existing class that exactly suits your needs, you can simply use it and benefit from the predefined behavior. Inheritance comes into play when a class does not do quite what you want. This situation is not much different from adding functions to an existing code library. Through inheritance you can take advantage of existing behavior but also graft on any additional capabilities you need. For example, if you know that you want to create a Blue jay class and none exists, you can use an existing Bird class by inheriting from it, then modify it to suit your specific situation.

When one class forms the basis for a new class, as a Bird class might for a Blue jay class, the original class is often referred to as the base (or parent) class. For obvious reasons, a class derived from another class is called a derived class or a child class.

Multiple Inheritance

In nature, multiple inheritance is the norm, but in the world of OO PHP, an object can have only one parent class. The creators of PHP 5 rejected the idea of multiple inheritance for classes. To see why, let’s use the Bird class again to show what multiple inheritance is and how it can lead to problems. If you wanted to create a Whooping crane class, it would make sense to derive this class from the Bird class. Suppose you also have an Endangered species class. Multiple inheritance would allow you to create a Whooping crane class from a combination of these two classes. This would seem to be an excellent idea until you realize that both classes define an eating behavior. Which one should you prefer? Awkward situations like this highlight the disadvantages of multiple inheritance. With single inheritance this kind of situation never arises.

Having Your Cake and Eating It Too

Single inheritance offers a simpler and more straightforward approach, but there are times when you may wish to combine behaviors from different classes. A whooping crane is both a bird and endangered. It does not make sense to build one of these classes from scratch every time you want this combination. Is there a way of combining different classes and avoiding the problem of overlapping behavior?

PHP solves this problem by introducing the concept of an interface. In this context, interface means a class with no data members that is made up only of functions that lack an implementation (function prototypes with no bodies). Any class that inherits from an interface must implement the missing function body. If Endangered species were an interface rather than a class, having more than one eating function would not matter. The method definition in the Bird class would act as the implementation of the interface function. In this way interfaces avoid the problem of defining the same function twice.

Because PHP does not require function prototyping, you may be unfamiliar with this concept. A function prototype is the declaration of a function name and parameters prior to its use-the function signature, if you like.

A class may inherit from only one class, but because interfaces lack an implementation any number of them may be inherited. In true PHP fashion, interfaces contribute to a powerful but flexible programming language.

Interfaces can be described as abstract because they always require an implementation. Because they are abstract, interfaces bear more resemblance to templates than classes do. Unlike classes, they can never be used "as is", they are only meaningful in the context of inheritance. Because interfaces lack an implementation they can act only as a model for creating a derived class.

Object Oriented Features NeObject Oriented Features New To PHP 5w

PHP 3 was released in mid-1998. Some basic object-oriented (OO) capabilities were included, more or less as an afterthought, to “provide new ways of accessing arrays.” No significant changes were made to the object model when version 4 was released in mid-2000. The basics of objectoriented programming (OOP) were there-you could create a class and single inheritance was supported.

With the release of PHP 5 in 2004 there was plenty of room for improving PHP’s OO capabilities. At this point, Java, the most popular OO language to date, had already been around for almost 10 years. Why did it take PHP so long to become a full-fledged OO language? The short answer is because PHP is principally a web development language and the pressures of web development have only recently pushed it in this direction.

Support for objects has been grafted onto the language-you can choose to use objects or simply revert to procedural programming. That PHP is a hybrid language should be viewed as something positive, not as a disadvantage. There are some situations where you will simply want to insert a snippet of PHP and other situations where you will want to make use of its OO capabilities.

In some cases, an OO solution is the only solution. PHP 5 recognizes this fact and incorporates a full-blown object model, consolidating PHP’s position as the top server-side scripting language.


Access Modifiers
Built in Classes
Backward Compatibility
Where to Go from Here

Access Modifiers

PHP 5 gives us everything we would expect in this area. In previous versions of PHP there was no support for data protection, meaning that all elements of a class were publicly accessible. This lack of access modifiers was probably the biggest disincentive to using objects in PHP 4.

A notion closely related to data protection is information hiding. Access modifiers make information hiding possible by exposing an interface. This is also referred to as encapsulation of an object.

Built in Classes

Every OOP language comes with some built-in classes, and PHP is no exception. PHP 5 introduces the Standard PHP Library (SPL), which provides a number of ready-made classes and interfaces. As of version 5.1, depending upon how PHP is configured, all in all, there are well over 100 built-in classes and interfaces-a healthy increase from the number available in version 5.0.

Having ready-made objects speeds up development, and native classes written in C offer significant performance advantages. Even if these built-in classes do not do exactly what you want, they can easily be extended to suit your needs.

Exceptions

All OOP languages support exceptions, which are the OO way of handling errors. In order to use exceptions, we need the keywords try, catch, and throw. A try block encloses code that may cause an error. If an error occurs, it is thrown and caught by a catch block. The advantage of exceptions over errors is that exceptions can be handled centrally, making for much cleaner code. Exceptions also significantly reduce the amount of error-trapping code you need to write, which offers welcome relief from an uninspiring task. Also, having a built-in exception class makes it very easy to create your own customized exceptions through inheritance.

Database Classes

Because PHP is all about building dynamic web pages, database support is allimportant. PHP 5 introduces the mysqli (MySQL Improved) extension with support for the features of MySQL databases versions 4.1 and higher. You can now use features such as prepared statements with MySQL, and you can do so using the built-in OO interface. In fact, anything you can do procedurally can also be done with this interface.

SQLite is a database engine that is incorporated directly into PHP. It is not a general-purpose database like MySQL, but it is an ideal solution in some situations, in many cases producing faster, leaner, and more versatile applications. Again an entirely OO interface is provided.

PHP versions 5.1 and higher also bundle PHP Data Objects (PDO) with the main PHP distribution. If you need to communicate with several different database back ends, then this package is the ideal solution. PDO’s common interface for different database systems is only made possible by the new object model.

Web Services

In PHP 5 all Extensible Markup Language (XML) support is provided by the libxml2 XML toolkit (www.xmlsoft.org). The underlying code for the Simple API for XML (SAX) and for the Document Object Model (DOM) has been rewritten, and DOM support has been brought in line with the standard defined by the World Wide Web Consortium.

Unified treatment of XML under libxml2 makes for a more efficient and easily maintained implementation. This is particularly important because support for XML under PHP 4 is weak, and web services present many problems that require an OO approach.

Under PHP 4, creating a SOAP client and reading an RSS feed are challenging programming tasks that require creating your own classes or making use of external classes such as NuSOAP (http://sourceforge.net/ projects/nusoap). There is no such need in PHP 5.

Reflection Classes

The reflection classes included in PHP 5 provide ways to introspect objects and reverse engineer code. The average web developer might be tempted to ignore these classes.

Iterator

In addition to built-in classes, PHP 5 also offers built-in interfaces. Iterator is the most important, as a number of classes and interfaces are derived from this interface.

Backward Compatibility

Backward compatibility may be an issue if your code already uses objects. PHP 5 introduces a number of new "magic" methods. Magic methods begin with a double underscore, and this requires changing any user-defined methods or functions that use this naming convention. The most important ones relate to how objects are created and destroyed. The PHP 4 style of object creation is still supported, but you are encouraged to use the new magic method approach.

PHP 5 deprecates some existing object-related functions. For example, is_a has been replaced by a new operator, instanceof. This particular change won’t affect how your code runs under PHP 5. If you use a deprecated function, you will see a warning if the error-reporting level is set to E_STRICT. In another example, the get_parent_class, get_class, and get_class_methods functions now return a casesensitive result (though they do not require a case-sensitive parameter), so if you are using the returned result in a case-sensitive comparison you will have to make changes.

Pass By Reference

The preceding examples of changes are relatively minor and fairly easy to detect and upgrade. However, there is one change in particular that is of an entirely different magnitude.

The major change to PHP in version 5 relating to OOP is usually summed up by saying that objects are now passed by reference. This is true enough, but do not let this mask what is really at issue: a change in the way that the assignment operator works when used with objects.

Granted, the assignment operator is often invoked indirectly when an object is passed to a function or method, but objects are now passed by reference because of the implicit assignment. Prior to PHP 5, the default behavior was to assign objects by value and pass them to functions by value.

This is perfectly acceptable behavior for primitives, but it incurs far too much overhead with objects. Making a copy of a large object by passing it by value can put strains on memory and in most cases, all that is wanted is a reference to the original object rather than a copy. Changing the function of the assignment operator is a fairly significant change. In fact, the scripting engine that underlies PHP, the Zend engine, was entirely rewritten for PHP 5.

In PHP 4 it is possible to pass objects by reference using the reference operator (&), and in fact it is good programming practice to do so. Needless to say, this use of the reference operator becomes entirely superfluous after upgrading to PHP 5.

Prognosis

The mere enumeration of the details of backward compatibility masks what can be a highly charged issue. Whenever you change an established language, there are competing interests. In many cases you are damned if you do and damned if you do not. For example, retaining inconsistent function naming conventions may be necessary to maintain backward compatibility, but you may also be criticized for this very lack of consistency.

Of course, breaking backward compatibility means that some existing code won’t function properly. In many circumstances it is not easy to decide where and when to break backward compatibility, but changing PHP to pass objects by reference is a fairly defensible change despite any inconveniences. The only thing you can be sure of is that any change will give rise to complaints in some quarter. Certainly, having deprecated functions issue warnings is one good way to give advance notice and let developers prepare for coming changes.