Get Creative With Digital Photography

It’s true that old-fashioned film photography is an art form. In fact, in this day and age, that’s about all it is, which is somewhat ironic. After all, film photography started off in 1837 as something very few could enjoy or do. As it is turning out, people who enjoy film photography are again becoming an exclusive club.

The artistic expression available through film is astounding. If you’ve never taken a film photography class, you should. It will ultimately make you a better photographer as you will have a full understanding of the art form in general.

However, unless you plan on investing in a darkroom (water, light, equipment), or if you plan on spending quite a bit of money at photo processing labs, you might concentrate most of your efforts on digital photography. In the long term, it’s generally less expensive than film, since you print only the photos you want. Also, it provides quite a bit of artistic expression of its own.

Digital photography has often been looked at by film buffs as not being artistic. That simply isn’t the case any longer. With the advancement in software programs such as Adobe Photoshop, the digital photographer can take their art as far as their knowledge of the software will take them.

The creativity involved with digitally manipulating an image isn’t reserved to expensive programs like Photoshop (though the price of software will be far less than the cost of setting up a darkroom).

In fact, many digital cameras designed for kids and young adults now come with features that allow changes to be made to the digital photo while it’s still stored in the camera. The picture can then be uploaded to a computer, in some cases wirelessly.

There are easy photo sharing websites that allow the photographer to manipulate the photo after it’s been uploaded to the site. These usually allow for straightforward changes, such as adjusting contrast, taking out the dreaded red eye, cropping, rotating, etc.

Also, digital photographers have the whole world wide web at their fingertips. This isn’t to say film buffs can’t scan one of their photos in and get it out on the Internet. But let’s face it, showing your work to the world is a whole lot easier if the image is digital from the start.

Once the image is on the Internet and has been enhanced, it’s easy to share it with whoever you want. This is another advantage digital creativity has. In the blink of a camera’s shutter, you can send your artwork around the world to friends, relatives, potential buyers.

Of course, such ease has its pitfalls as well. Unscrupulous types can copy your image, unless you take precautionary steps such as digital or visual watermarking.

Creativity is a very personal thing, and each person much express his or her self in their own particular way. However, given our busy world, and given the relaxation and contentment that creative expression provides, it’s not a bad idea to pick an art form such as digital photography, one that allows you to express yourself quickly and easily.

The Validity Of The Digital Art Medium

Despite the reluctance of mainstream traditional art forums to admit digital art as a serious art form, the field is explosive and gaining ground everyday across the internet, in museums, galleries, and competitions. There is much to be argued in the field, but as a digital artist myself, as well as a vehement proponent for the validity of the digital art medium, I will argue for the validity of the digital medium as a serious art form, as well as attempt to dispel the common myths concerning the medium.

Like any other medium, there are artists of varying degrees of skill, talent, and experience, but there is a level of competence that qualifies in terms of time, effort, thought, presentation, and composition that goes far beyond the snobbery of dismissing the works of such artists as ‘nothing but a few clicks.” The beginning painter or sculptor can easily match this label of “just a few clicks” with a bad representation of form, color and composition in what could be called “just a few strokes.”

This author believes that the main resistance in the traditional art world to digital artistry is related to more of a financial and social exclusivity then any actual lack of talent or work on the part of the serious digital artist. In a world of rapidly diminishing resources and increasing toxicity it might even be reasonable argued that traditionalists waste materials and precious natural resources such as trees, clean water, and introduce other factors of pollution in the use of toxic paints and solutions used in other mediums.

Artistic digital expression is the ultimate resource saving tool in this sense. The average computer, if run for an entire month, averages about 40.00 to operate, and all drawing, painting, 3D sculpturing, and other methods of artistic expression are recycled as easily as pushing the delete key. Photographers and photo manipulation experts can now take a wealth of stock photos with the digital camera, and eliminate the need for toxic dark room chemicals, or expensive development costs.

There is certainly no lack of digital fine art, nor talent in the new medium. I believe it’s time that people begin considering the benefits of digital mediums and stop sneering at the artists simply because they develop self-expressive art forms without the wasteful tools and toxic by products of traditional artists. The same discerning standards may be easily applied to any digital piece of art, whether still, multimedia, or interactive presentations. In the end, it is all the expression of the human soul, and therefore cannot be dismissed as an invalid medium on any reasonable grounds.

Introduction To Regular Expressions In PHP

In Linux and Unix, the syntax that is commonly used by many applications for specifying text patterns is known as regular expressions or in short form – regex. Regex is a very powerful technique to describe patterns and many programs use them to describe sequences of characters to be matched. Search programs such as ‘grep’ rely heavily on regex. Basically regex forms the core in the linux world. Many scripting languages such as perl, ruby, php…etc has build in regex functions as well. So you can see, learning regular expression is important because they are used a lot in many places and probably more so in the future.

Regex can be scary at first but if you can get the basics, it is really not too hard to understand. In this article, we are going to look at how regex comes into the picture when writing php applications.

To do a quick summary so far, a regular expression is a sequence of literal characters, wildcards, modifiers and anchors.

Literal Characters

Literal characters are letters, digits and special characters that match only themselves. Examples are abc, 123, [email protected] and so on (some characters are reserved though).

– An inclusion range [m-n] matches one of any character included in the range from m to n.

Example ‘[a-z]’ will match any alpha character that falls within the a to z range.

– An exclusion range [^m-n] matches one of any character not included in the range from m to n. Example ‘[^0-9]’ will match any non-digit character.

– A period “.” matches any character. It is also known as the wildcard. Example ‘a.c’ will match ‘aec’, ‘acc’, ‘[email protected]’ and so on.

– The escape character ” enable interpretation of special characters. Example ‘a.c’ will match ‘ac’ only. Remember that ‘.’ is a reserved character to represent a wildcard? Therefore to match a period, ie ‘.’, we need to escape it like so ‘.’

– The expression [:alnum:] will match all alpha-numeric characters. It is a shortcut to [A-Za-z0-9]. As you can see, it is not really a shortcut. The expression [:alnum:] might be easier to remember for some people.

– The expression [:alpha:] will match all alpha characters. It is a shortcut to [A-Za-z].

– The expression [:blank:] will match a space or tab.

– The expression [:digit:] will match a numeric digit. It is a shortcut to [0-9].

– The expression [:lower:] will match all lowercase letters. It is a shortcut to [a-z].

– The expression [:upper:] will match all uppercase letters. It is a shortcut to [A-Z].

– The expression [:punct:] will match all printable characters, excluding spaces and alphanumerics.

– The expression [:space:] will match a whitespace character.

Modifiers

A modifier alters the meaning of the immediately preceding pattern character.

– An asterisk (‘*’) matches 0 or more of the preceding term. Example ‘a*’ will match ”, ‘a’, ‘aa’, ‘aaaaa’ and so on (Note the use of ”. It simply means that the expression matches nothing as well).

– A question mark (‘?’) matches 0 or 1 of the preceding term. Example ‘a?’ will match ” and ‘a’ only.

– A plus sign (‘+’) matches 1 or more of the preceding term. Example ‘a+’ will match ‘a’, ‘aaaaaaa’ and so on. It will not match ”.

– {m,n} matches between m and n occurrences of the preceding term. Example ‘a{1,3}’ will match ‘a’, ‘aa’ and ‘aaa’ only.

– {n} matches exactly n occurrences of the preceding term. Example ‘a{2}’ will match ‘aa’ only.

Anchors

Anchors establish the context for the pattern such as “the beginning of a word” or “end of word”.

– The pike ‘^’ marks the beginning of a line. Example ‘^http’ will match any new line that starts with ‘http’.

– The dollar sign ‘$’ marks the end of a line. Example ‘after$’ will match any line that ends with ‘after’. (Variables in php starts with $. Try not to confuse with it).

Grouping

Grouping ‘( )’ allows modifiers to apply to groups of regex specifiers instead of only the immediately proceding specifier. Example ‘( aa | bb )’ will match either ‘aa’ or ‘bb’

Enough of boring stuff, it is time to put what the theory of regex into good use.

PHP Implementation

There are 2 main variants of regex, Perl-compatible regex (PCRE) and POSIX-Extended. PHP offers quite a lot of functions to implement these 2 types of regex. In PHP, the most commonly used PCRE function is ‘preg_match’ and in POSIX-extended regex, ‘ereg’. Both syntax are slightly different but equally powerful. The preference to use ‘preg_match’ or ‘ereg’ is entirely up to individual although Zend suggested that preg_match is slightly faster. I prefer to use ‘eregi’ simply because of my background in linux administration.

Example 1: Matching United States 5 or 9 digit zip codes

Zip codes in USA have the following format ##### or #####-#### where # is a digit. If you want to verify the zip code submitted say from an online form, you will need to use regex somewhere in your script to verify it. The matching POSIX-extended regex pattern will be:

[[:digit:]]{5}(-[[:digit:]]{4})?

Confused? Wait, let me explain why. This regex is split up into 2 parts: [[:digit:]]{5} and (-[[:digit:]]{4})?.

First Part: ‘[[:digit:]]’ means the digit range and {5} means that the digit must occur 5 times.

Second Part: The bracket ‘( )’ groups the ‘-[[:digit:]]{4}’ together and the ‘?’ means the expression ‘(-[[:digit:]]{4})’ can either occur 0 or 1 time.

To implement the regex in PHP, we use the following code:

$zipCodes = ‘xxxxx-xxxx’;

$pattern = ‘[[:digit:]]{5}(-[[:digit:]]{4})?’;

if (ereg($pattern,$zipCodes)) {

echo “matched found “;

}

else {

echo “match not found”;

}

Example 2: Matching Dates

Say we want to verify the dates entered by the user. If we only accept dates like “YYYY-MM-DD” or “YYYY-M-D”, the regex pattern will be

[0-9]{4}(-[0-9]{1,2})+

The ‘+’ behind the term (-[0-9]{1,2}) means that the term must occur at least once. Note that I can also rewrite the regex as:

[[:digit:]]{4}(-[[:digit:]]{1,2})+

or

[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}

As you can see, there can be many solutions to a problem…

Conclusion

Regex may be hard to digest at first but the logic is simple if you are able to practice more. Learning regex is as important as learning PHP. More examples can be seen at web-developer.sitecritic.net. Good luck.