2015-09-28 16:54:29 +02:00
2015-09-28 00:35:10 +02:00
2015-09-28 00:35:10 +02:00
2015-09-28 00:53:50 +02:00
2015-09-28 00:35:10 +02:00
2015-09-28 00:35:10 +02:00
2015-09-28 00:35:10 +02:00
2015-09-28 00:35:10 +02:00
2015-09-28 16:54:29 +02:00
2015-09-28 15:37:52 +02:00
2015-09-28 16:23:12 +02:00

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

Install

  • Install wkhtmltox on your server
  • Make /usr/sbin/wkhtmltoimage executable for the user that runs the webserver. For Apache it's the www-data user. Or use sudo
  • Make sure the server has the "timeout" command. For debian this is available via apt-get install coreutils
  • Download this repo and extract it somewhere on your webserver

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

HS logo

Description
No description provided
Readme 27 MiB
Languages
JavaScript 51.2%
PHP 24.1%
CSS 10.9%
Less 9.7%
Dockerfile 2.9%
Other 1.2%