diff --git a/dependencies/screenshot.js b/dependencies/screenshot.js index 08f8d76a3..c15792611 100644 --- a/dependencies/screenshot.js +++ b/dependencies/screenshot.js @@ -1,9 +1,9 @@ var page = require('webpage').create(), - address, output, size, w, h, agent; + address, output, size, w, h, agent, full; -if (phantom.args.length < 4 || phantom.args.length > 5) { - console.log('Usage: screenshot.js URL filename width height user-agent'); +if (phantom.args.length < 5 || phantom.args.length > 6) { + console.log('Usage: screenshot.js URL filename width height user-agent full'); phantom.exit(); } else { address = phantom.args[0]; @@ -11,7 +11,8 @@ if (phantom.args.length < 4 || phantom.args.length > 5) { w = phantom.args[2]; h = phantom.args[3]; agent = phantom.args[4]; - + full = phantom.args[5]; + page.viewportSize = { width: w , height: h}; page.settings.userAgent = agent; page.open(address, function (status) { @@ -19,7 +20,9 @@ if (phantom.args.length < 4 || phantom.args.length > 5) { console.log('Unable to load the address!'); } else { window.setTimeout(function () { - page.clipRect = { left: 0, top: 0, width: w, height: h }; + + if (full != 'true') + page.clipRect = { left: 0, top: 0, width: w, height: h }; page.render(output); phantom.exit(); }, 200); diff --git a/sitespeed.io b/sitespeed.io index 0e649a42c..7c89a88b2 100755 --- a/sitespeed.io +++ b/sitespeed.io @@ -431,7 +431,7 @@ if $OUTPUT_IMAGES for url in "${urls[@]}" do echo "Creating screenshot for $url $REPORT_IMAGE_PAGES_DIR/$PAGEFILENAME.png " - phantomjs $PROXY_PHANTOMJS $DEPENDENCIES_DIR/screenshot.js "$url" $REPORT_IMAGE_PAGES_DIR/$PAGEFILENAME.png $WIDTH $HEIGHT "$USER_AGENT" + phantomjs $PROXY_PHANTOMJS $DEPENDENCIES_DIR/screenshot.js "$url" $REPORT_IMAGE_PAGES_DIR/$PAGEFILENAME.png $WIDTH $HEIGHT "$USER_AGENT" true if $PNGCRUSH_EXIST then pngcrush -q $REPORT_IMAGE_PAGES_DIR/$PAGEFILENAME.png $REPORT_IMAGE_PAGES_DIR/$PAGEFILENAME-c.png