IMPORTANT NOTE: If you completed the Creating Layer Comps Using An INTERNAL Data Source, you can skip down to IMPORT DATA SOURCE tab.
Resource: exercise_files
Using variables in Photoshop is akin to using layer comps. The major different is that when you use variables you are retrieving the data from a data source instead of just turning layers on and off. Photoshop can use layer names as variable placeholders. Then, these placeholders can be "filled" with data from a data source which could be a simple text file. This is akin to using a mail merge program or even server-side scripting like Coldfusion, ASP(.NET), PHP or JSP. Like Layer comps, this can save you a ton of time if you need to create a multitude of images that have basically the same layout (template) but need different text and graphic on each image (e.g., business cards, trading cards, web ads, web banners, posters, etc.).
Images need to be created or prepared that will be used to replace the placeholders.
Like most database driven applications, it is best to define the database (or data source) BEFORE you build an application. Likewise, we will first start with a data source so we will know in advance how to name the variables using the first row in our data source. You now need to bind or connect the (layer) variable names with the names in the data source. This is akin to what is done when binding data to a database using server-side technologies (e.g., ColdFusion, etc.). There are two ways to create a data source: external or internal. In this tutorial we will use an external data source.
To create a data source OUTSIDE of Photoshop, follow the procedure below:
EXAMPLE OF DATA HERE:
employee_full_name | start_date | extension | notes | photo | department_name |
Ann Ricoh | 12-Mar-07 | 2563 | Ann enjoys bike riding and reading. | images/ann_ricoh.jpg | Finance |
Bob Anderson | 3-Mar-07 | 8765 | Bob enjoys spending time with family and friends. | images/bob_anderson.jpg | Finance |
Carol Green | 1-Feb-07 | 9863 | Personal interests include mountain climbing and snow skiing. | images/carol_green.jpg | IT |
Debra Samson | 5-May-06 | 2364 | Loves working with communities groups to help enhance her community. | images/debra_samson.jpg | IT |
Jason Taylor | 15-Jan-07 | 2589 | Love reading and writing for local organizations. | images/jason_taylor.jpg | Operations |
Josiah Louis | 11-Feb-07 | 5896 | Personal interests include playing basketball and football. | images/josiah_louis.jpg | Human Resources |
Mary Thompson | 23-Jul-08 | 5236 | Personal interests include modeling and swimming. | images/mary_thompson.jpg | Marketing |
Rickey Long | 20-Apr-07 | 8593 | Loves doing outdoors activities with friends. | images/rickey_long.jpg | Finance |
Sam Donaldson | 6-Feb-07 | 3345 | Loves spending time with his wife and kids doing outdoors activities. | images/sam_donaldson.jpg | Finance |
Sheila Davis | 11-Feb-07 | 3434 | Love to help other less fortunate than herself. | images/sheila_davis.jpg | Finance |
Sue Williams | 5-Apr-07 | 2563 | Loves to sing and dance. | images/sue_williams.jpg | Finance |
Tammy Jones | 12-Apr-07 | 7485 | Enjoys going to the movies. | images/tammy_jones.jpg | Operations |
NOTE: Path names to images can be absolute or relative to the folder where the images are located (e.g., images).
Create a layout template using static and dynamic text and graphics layers as placeholders.
IMPORTANT: Because the layer names will be treated as variables later, you must follow the following naming convention for layers that will be dynamic: Variable names must begin with a letter, underscore, or colon and cannot contain spaces or special characters (except for periods, hyphens, underscores, and colons).
Create Background Layer
Create Dynamic Text Placeholder(s) via Text tool
Create Dynamic Graphic Placeholder(s) via Rectangle Tool or a Real Image
Create STATIC text fields or STATIC graphics
The dynamic layer names in the Layers Panel need to be "matched" to the header names in the data source for both the text and graphics layers.
Create Text Data Set
Create Graphic Data Set
Create a data set from the text file as the data that will fill the placeholders with real values.
You can now export the the result as individual Photoshop psd files.
Normally if you try to transform (e.g., rotate) an image on a layer, when it is replaced by the real image it will be straight again. To resolve this problem, create a script to rotate that particular layer and then preform a Batch process on those images
Create a simply Action to: