There are many cases when you may want to take a screenshot of a webpage from command line or programmatically from a PHP script or a .NET program.
Taking Screenshots of Websites with .NET Windows Forms
In order to take screenshots in .NET you might use a WebBrowser control and saves an image rendered.
If you are looking for code examples to take webpage screenshots in PHP, read the post Taking Screenshots of Websites with PHP.
Continue reading
Taking Screenshots of Websites with PHP
There are many command lines tools you can use to take a screenshots of a web page. See the list of tools here: in Windows, in Linux. The mentioned tools can be used on a from a php script using shell_exec function.
* If you are looking for taking screenshots programmatically in .NET – read the post Taking Screenshots of Websites with .NET Windows Forms.
Take screenshots of websites from command line in Windows
There are many tools to take/capture screenshots from command line in Windows.
If you are looking for command line tools in Linux – read this post.
Take screenshots of websites from command line in Linux
There are several ways to take screenshots in Linux. Most of them produce a WebKit, Gecko (Firefox) or khtml rendered screenshot image. Some of the methods require X session to open a window and take screenshots.
Read how to take screenshots from command line in Windows in this my post.
Executing raw SQL in Django
Sometimes you need to run a custom SQL query and return results that do not correspond to your model or make SQL queries to UPDATE or DELETE directly on a database.
Some scenarious:
– make a specific SELECT query and return a list of rows which are dictionaries (not objects of a model)
– make UPDATE or DELETE queries
Functions and recursion in Smarty Templates
The code below defines a recursively callable function in the Smarty template itself and calling it. For example, it renders hierarchical menu when the level of the tree is not known and can be deep.
Cropping and resizing images using MiniMagick (Ruby on Rails)
There are a number of algorithms to crop and resize images. Like maintaining the original image’s aspect ratio, cropping over-sized images, padding to fill empty area.
This post shows two approaches – with cropping and without cropping. Continue reading
Rails 3 Select Tag with List of Countries
This post is to assist to create a select tag in a view (HTML) with a list of countries.
The solution presented here:
– The countries are stored in a table in database. If you don’t want to have a table with countries in DB, you can easily modify the code below to have countries as an array in code.
– Helper to show a list of countries in select tag in HTML
You can find the whole solution on github.
ASP.NET MVC file uploads using Valums Ajax Uploader plugin
File uploading is one of the common tasks in web development.
One of the best scripts for file uploading is valums/file-upoader.