Update thumbnail-images for the examples-overview file
marcjansen opened this issue · comments
Since #258 we have an examples tab included in the API-docs generated by jsduck
.
The images of the preview page are a little bit outdated and do not always match the example they should represent.
We should upodate the thumbnails so they all match again.
Here are some lines of code from @hutzelknecht that might help generating these automatically:
var
system = require('system'),
webpage = require('webpage'),
baseUrl = encodeURI(system.args[1]),
examples = [
"action/mappanel_with_actions.html",
"app/simple/simple.html",
"geocoder/geocoder.html",
"grid/feature-grid.html",
"layeropacityslider/layeropacityslider.html",
"legendpanel/legendpanel.html",
"mappanel/mappanel.html",
"permalink/permalink.html",
"popup/popup.html",
"printextent/print-extent.html",
"printform/print-form.html",
"printpage/print-page.html",
"printpreview/print-preview.html",
"renderer/renderer.html",
"stylegrid/style-grid.html",
"tree/tree-legend.html",
"wfscapabilities/wfscapabilities.html",
"wmscapabilities/wmscapabilities.html",
"zoomchooser/zoomchooser.html",
"zoomslider/zoomslider.html"
];
var capture = function(exampleUrl, ii){
var page = webpage.create(),
pageUrl = baseUrl + exampleUrl;
page.viewportSize = { width: 118*4, height : 90*4 };
page.open(pageUrl, function() {
var image = 'thumb_test_'+ ii +'.png';
window.setTimeout(function(){
page.render( image );
if ( ii == examples.length - 1 )
window.setTimeout(phantom.exit, 4000);
},20000);
});
}
for (var i = 0; i < examples.length; i++) {
var url = examples[i];
console.log("capturing page " + i + ": ", url);
capture(url,i);
}
I managed to write a script that does the job. The only work left is to measure the extents of the clippings - then we should be set to go.
Cool. Where is it?
Hi Marc, patience. It's still at home on my local disk. I'm glad when I find the time to develop for an hour after my son goes to sleep before I fall asleep myself ;-)
I'm calm now 😄 Just keep us updated, @hutzelknecht.
i think it's safe to close this issue now.
Oh yes. Totally forgot this one.