Http2pic
Simple API for creating screenshots of websites
Install / Use
/learn @geek-at/Http2picREADME
http2pic
Introduction
http2pic is an Open Source website renderer. It uses the wkhtmltox to render websites with various options.
Live demo on https://http2pic.haschek.at/
Dependencies
- wkhtmltox
- curl extension for PHP
apt-get install php5-curl - Make sure the server has the "timeout" command
apt-get install coreutils
Install
- Download this repo and extract it somewhere on your webserver
With WKHTMLToImage
- Install wkhtmltox on your server
- Make /usr/sbin/wkhtmltoimage executable for the user that runs the webserver. For Apache it's the
www-datauser. Or use sudo
With PhantomJS
- Install PhantomJS. eg via
npm install -g phantomjs - Make /usr/bin/phantomjs executable for the user that runs the webserver. For Apache it's the
www-datauser. Or use sudo
Upgrade
Whenever you come to this page you can just download the repo again and overwrite the existing files. Should work out of the box
Usage
After you extracted the contents of this repo to your webserver and can access the page and it will tell you how to use the API.
But it's as simple as:
https://your-url-and.path/api.php?[OPTIONS]&url=[WEBSITE_URL]
The requested page will render as image (not provide a link). So you can use the path to your api.php file like so:
<img src="https://your-url-and.path/api.php?url=http://xkcd.com" title="screenshot of xkcd.com" />
Example php script to proxy an image to the local server
<?php
$targeturl = 'http://www.xkcd.com';
$url = 'https://http2pic.haschek.at/api.php?url='.rawurlencode($targeturl);
$ch = curl_init($url);
$fp = fopen('xkcd.jpg', 'wb');
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
fclose($fp);
?>
This is a HASCHEK SOLUTIONS project
Related Skills
node-connect
343.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
90.0kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
343.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
343.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。

