Author Archive

Begin Again

by WeblashAdmin on Jul.18, 2011, under Non-business

Well, after a few years of sedentary activity, I took the first step to getting back into shape by getting a trainer.

Leave a Comment more...

CSS Shorthand – I Need To Read More.

by WeblashAdmin on May.25, 2010, under CSS, stylesheets, web development

I stumbled upon this little shorthand trick today for CSS.

This…

.myFontStyle {
font-weight: bold;
font-style: italic;
font-variant: small-caps;
font-size: 10px;
line-height: 12px;
font-family: verdana, sans-serif;
}

is the same as this:

.myFontStyle {
font: bold italic small-caps 10px/12px verdana,sans-serif;
}

There’s a great slidedeck on CSS architecture here.

Leave a Comment :, more...


Smoke Effect Using Adobe Illustrator

by WeblashAdmin on Oct.02, 2009, under design, graphic design, media, print, techniques

I don’t know if there are other articles about creating smoke in Illustrator, or even if this is the best method, but I really like the outcome of my technique and wanted to share it.

  1. Create a blend using two Bézier curves. Use specified steps and set the number to 40 (you’ll probably need to play with this some before you get the effect you want):

    image

  2. Now, take one of the paths and put a gaussian blur on it (use about a radius of 6 pixels). Do the same with the other path, only change the radius on the blur to about 3 pixels:

    image

  3. OK, now modify the shape of the paths so that they overlap, crossing over each other. It should start to look more and more like smoke:

    image

  4. Apply blending and opacity settings to the paths like overlay, screen, multiply, etc. Play time.
  5. Copy/paste the blend and adjust the Bézier curves on that blend.
    image
  6. Cool, huh? Now, play with the color on each of the curves too.

    image

There you have it. I discovered it by accident, and I haven’t played with the technique too much. There’s probably an Illustrator plug-in or brush out there that does the same thing, so you can decide for yourselves if this is of any value.

4 Comments :, , more...

Automating PhotoShop Tasks Using PhotoShop APIs.

by WeblashAdmin on Sep.27, 2009, under C#, development

Melchor Berona of Photo-Essence recently hired me to design his website. One of his feature requests was to enable a fast, easy way to get photos to his galleries online. This sounds simple enough, I thought, and off I went.

As for any business, Melchor didn’t want to spend valuable hours replacing images in his online photo galleries. He wanted to get the high resolution photos to a usable format and size; then FTP to his site. The process turned out to be this:

  1. Get images to 96ppi
  2. Convert images to RGB
  3. Resize landscape or portrait to 600px height
  4. Save file with the correct filename to be used in the destination galleries – old files would be swapped with new files, so the naming on the new images needed to be the same as the images being replaced
  5. Create thumbnail images that are 150x150px
  6. save file with the appropriate naming
  7. FTP the new files (not covered here)

So I thought: I’ll just create a droplet – no problem, right? Well, it’s not ideal when you’re resizing both landscape and portraits using the scaling in PhotoShop. This really can’t be automated unless you make two separate droplets, one for landscape and one for portrait.

Then I discovered a folder in the PhotoShop directories (in the Programs directory) that gives a pretty good introduction to automating tasks (and more) using scripting in JavaScript, VBScript, or ActionScript.

OK – now we’re getting somewhere, I thought. However, I wanted to take this a step further. I wanted to make a C# console application using the PhotoShop APIs. I didn’t find much documentation, but I did find a very good tutorial  by John Deurbrouck here: http://www.pcpix.com/Photoshop/.

After I read that I was on my way. For this blog entry, I’d like to walk through my process of developing the application I delivered to my client.

Step 1 – Do Some Research

Get information on PhotoShop Scripting here: http://www.adobe.com/devnet/photoshop/scripting/

There are some PDFs here that go into detail about scripting for VB, JavaScript, and AppleScript. There’s also information about the ScriptListener.

Step 2 – turn on the ScriptListener

The PhotoShop ScriptListener logs every event you do in PhotoShop, from opening a document, modifications, saving, and closing it. So it should only be turned on when you are performing the steps you’ll use for your automation application. From Adobe…

Installing ScriptListener

The ScriptListener plug-in is located in the ..\Adobe Photoshop CS4\Scripting\Utilities folder.

To install the ScriptListener:

  1. Select the file ScriptListener.8li and then choose Edit > Copy.
  2. Paste the file copy to the following location: ..\Adobe Photoshop CS4\Plug-Ins\Automate
  3. Open Photoshop.
    1. NOTE: If Photoshop is already open, close it and then start it again. This will allow Photoshop to load
      the plug-in.

To uninstall the ScriptListener:

  1. Close Photoshop.
  2. Verify that a copy of the file ScriptListener.8li still exists in the ..\Adobe Photoshop CS4\
    Scripting\Utilities folder.
  3. Delete the file ScriptListener.8li from the following location: ..\Adobe Photoshop CS\Plug-Ins\Automate
  4. Delete the log files ScriptingListenerJS.log and ScriptingListenerVB.log from your desktop.
    1. NOTE: In Windows, even though you remove the ScriptListener from the Automate folder, it may continue
      to record actions. To prevent the ScriptingListenerJS.log file from becoming too large, delete it each
      time you finish playing a Photoshop action.

So when you’re ready to simulate an automation, go to your Actions, create a new action, and start going through the steps. When you’re finished, you’ll see two files on your desktop:

ScriptingListenerJS.log, containing JavaScript code
ScriptingListenerVB.log, containing VBScript code

These files contain – you guessed it, the steps you just performed when you created the action.

Now you can see the code that defined the steps in the action. From here you can convert these steps to C# with some help from the documentation by John Deurbrouck here: http://www.pcpix.com/Photoshop/.

Step 3 – Write your functions

I created a separate class in my application that contains all the PhotoShop action steps (opening the file, resizing, saving, changing canvas size, etc.). Below is an example:

public static void Resize(int iHeight, string category)
        {
            //get the original document dimensions
            double dWidth = getdim("X");
            double dHeight = getdim("Y");
            //convert datatype of iHeight
            double dNewHeight = Convert.ToDouble(iHeight);

            switch (category)
            {
                case "full":
                    break;
                case "mid":
                    //is the document landscape or portrait?
                    if (dWidth < dHeight)
                    {
                        //is portrait
                        dNewHeight = 300;
                    }
                    else
                    {
                        dNewHeight = 200;
                    }
                    break;
                case "thumb":
                    //is the document landscape or portrait?
                    if (dWidth < dHeight)
                    {
                        //is portrait
                        dNewHeight = (dHeight * dNewHeight) / dWidth;
                    }
                    break;
            }
            //run the action
            //describe the action
            int idImgS = app.CharIDToTypeID("ImgS");
            ps.ActionDescriptor desc3 = new ps.ActionDescriptor();
            //image height
            int idHght = app.CharIDToTypeID("Hght");
            //image resolution
            int idPxl = app.CharIDToTypeID("#Pxl");
            //not sure what the below does
            desc3.PutUnitDouble(idHght, idPxl, dNewHeight);
            //scale the styles too?
            int idscaleStyles = app.StringIDToTypeID("scaleStyles");
            desc3.PutBoolean(idscaleStyles, true);
            //the canvas?
            int idCnsP = app.CharIDToTypeID("CnsP");
            desc3.PutBoolean(idCnsP, true);
            //not sure what these do
            int idIntr = app.CharIDToTypeID("Intr");
            int idIntp = app.CharIDToTypeID("Intp");
            int idBcbc = app.CharIDToTypeID("Bcbc");
            //add the properties to prep execution
            desc3.PutEnumerated(idIntr, idIntp, idBcbc);
            //run execution of action
            app.ExecuteAction(idImgS, desc3, ps.PsDialogModes.psDisplayNoDialogs);
        }

So I have to admit it’s been quite a while since I wrote the code, and I am sketchy about defining the actions. http://www.pcpix.com/Photoshop/ has all the details about just what the code is that defines the action, and lists all of the enum names and values. I have asked John Deurbrouck and pcpix.com if I can distribute the article as a Word doc from my blog. I’ll keep you updated.

If you take on a project like this, you’ll find you’ll need to do some conversions from the code in the ScriptListener file to the C# code for the actions to get prepped properly.

Anyhow, this is a start. Please send me feedback! I’m not an experienced blogger so comments would be helpful.

4 Comments :, , , , more...

Using Shortcodes for Plug-ins in WordPress

by WeblashAdmin on Sep.05, 2009, under Uncategorized, WordPress, development, plug-ins

First step:  read the shortcode API reference in WordPress Codex. I had a difficult time figuring out exactly where to place the “add_shortcode” function call.

Second step:  Place the “add_shortcode(‘shortcut name’, ‘shortcut function’);” to the same place you put your add_action and add_filter calls — I’m basing this off the excellent tutorial I found — “How to Write a WordPress Plug-in“:

//add actions
add_action('admin_menu', 'DevloungePluginSeries_ap');
add_action('wp_head', array(&$dl_pluginSeries, 'addHeaderCode'), 1);
add_action('activate_devlounge-plugin-series/devlounge-plugin-series.php',  array(&$dl_pluginSeries, 'init'));

//Filters
add_filter('the_content', array(&$dl_pluginSeries, 'addContent'),1);
add_filter('get_comment_author', array(&$dl_pluginSeries, 'authorUpperCase'));

//Shortcodes
add_shortcode('shortcodename', array(&$dl_pluginSeries, 'function'));

http://www.devlounge.net/extras/how-to-write-a-wordpress-plugin
1 Comment :, , , , more...

Excellent Tutorial on developing WordPress Plug-ins

by WeblashAdmin on Sep.03, 2009, under WordPress, WordPress, content, development, plug-ins, web, web development

So I decided I was going to write my first plug-in for WordPress about a week ago. I felt it would be a good addition to WordPress users. It’s currently in development now so I’m not going to specify just what it is quite yet.

Having danced around and around the WordPress Codex, I wasn’t getting very far. Issue number one is: I’m not a PHP devleoper – yet! However, I got a long way very fast by reading through this tutorial by Ronald Huereca. I’ll give an update soon, when my plug-in is released.

If you’re struggling with the WordPress APIs, and want more insight to developing a plug-in for WordPress, check this out:

How to Write a WordPress Plugin

1 Comment :, , more...

Become a CSS Expert: The CSS Selector Reference From W3C

by WeblashAdmin on Aug.23, 2009, under CSS, stylesheets, web, web design, web development

I have at times struggled with CSS because I didn’t fully understand what I was looking at when modifying WordPress themes. Then I came across this resource when doing some jQuery work. It is unbelievable what you can do with CSS. I always thought it was remarkable before, but WOW, this really opens up a new avenue of theme customization for me.

W3C CSS Selectors

Leave a Comment :, , , more...

Cross-browser Compatibility Testing: A Great List of Tools

by WeblashAdmin on Aug.20, 2009, under Testing, development, web application, web design, web development

7 Awesome Resources to Test Cross Browser Compatibility of Your Website

”When there are many browsers available for the users to surf the internet, it becomes evident for you to check the Cross Browser Compatibility of your website. Different people use different operating systems and browsers and you cannot control their wish to surf your website on one particular browser, just because your website does not look well on it. Though among many available browsers, Mozilla and IE are the most used browsers around the world. But still while designing a website web designers make it sure to check the browser compatibility of the website in all browsers.”

2 Comments :, , more...