Giter Club home page Giter Club logo

http2pic's Introduction

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-data user. 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-data user. 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

HS logo

http2pic's People

Contributors

geek-at avatar danbovey avatar lekoaf avatar

Stargazers

Anthony DePaolo avatar

Watchers

James Cloos avatar Anthony DePaolo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.