Skip to content

Instantly share code, notes, and snippets.

@dblooman
Last active August 29, 2015 14:00
Show Gist options
  • Select an option

  • Save dblooman/8f2c4f3d1908d805ad1f to your computer and use it in GitHub Desktop.

Select an option

Save dblooman/8f2c4f3d1908d805ad1f to your computer and use it in GitHub Desktop.

Edit save_images.rb with

def capture_page_image(browser, url, width, file_name)
  width, height = width.split('x')
  puts `"#{browser}" #{@config['phantomjs_options']} "#{snap_file}" "#{url}" "#{width}" "#{file_name}" "#{height}"`
end

Edit snap.js with

var view_port_height = system.args[4];
page.viewportSize = { width: view_port_width, height: view_port_height};

Edit config with

screen_widths:

  • 1280x1024
@jimCresswell

Copy link
Copy Markdown

So I went with doing the split in the snap.js file. One side-effect of that hack is that the gallery images are marked with and ordered by the "size" which ignores the 'x' part of the argument

https://github.com/BBC-News/wraith/blob/a660b71a96a422ea8fbc500536c56858a1ac5588/lib/wraith/gallery.rb#L42

so images with the same width are treated as being part of the same set of snaps and only one of the diff images in that set will be displayed. Can be worked around by making sure no two widths are the same, e.g.

http://dev.labs.ft.com/jim/wraith-experiments/shots1/gallery.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment