Skip to content

Instantly share code, notes, and snippets.

@johnbintz
Last active December 28, 2015 22:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnbintz/7574995 to your computer and use it in GitHub Desktop.
Save johnbintz/7574995 to your computer and use it in GitHub Desktop.
Adding references to our images in the Cardfile.
@session.configure do |c|
c.svg_source = "template.svg"
c.svg_merged_target = "merged-template.svg"
c.png_export_width = 825
c.pdf_dpi = 300
c.pdf_card_size = "750x1050"
c.individual_files_path = "svgout/output_%03d.svg"
c.png_files_path = "pngout-svggvs/output_%03d.png"
c.pdf_target = "pnp/game.pdf"
end
card_data = [
{
# add the Image layer...
active_layers: [ 'Image', 'Superpower', 'Noisy', 'Action', 'Puppy', 'Name', 'Background' ],
# ...and the path to each of our images.
replacements: {
'Image' => 'images/dog.png.jpg',
'Superpower Text' => 'Jumps around!',
'Name' => 'Woofie',
'Action' => 'Bark at the person who is ringing the doorbell.'
}
},
{
# then do it again!
active_layers: [ 'Image', 'Superpower', 'Cute', 'Action', 'Kitten', 'Name', 'Background' ],
replacements: {
'Image' => 'images/cat.png.jpg',
'Superpower Text' => 'Scratches things!',
'Name' => 'Hisshead',
'Action' => "Demand food by clawing at your owner's lap."
}
},
]
@session.process do
card_data.each do |card|
@session.with_new_target do |target|
target.active_layers = card[:active_layers]
target.replacements = card[:replacements]
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment