prepared for full screenshots #102
This commit is contained in:
parent
3713f47fd7
commit
d6715bdcc6
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue