Gyazo on your own server

    Hi, Habr!
    image
    My friends and I have been using the Gyazo program for a long time .

    In short: a small program, when launched, you can immediately select an area on the screen, and as soon as you release the mouse, the area is uploaded to the gyazo server, and a link to it is immediately copied to the clipboard.
    You can try it here: http://gyazo.com

    Recently, its creator decided to monetize its development, and in addition to paid features, it included intrusive ads for non-premium users.

    First, not a direct link to the image was copied to the clipboard, but a link to the page with the advertisement. Then the direct file became completely inaccessible.

    Since gyazo is an Open Source project, I decided to make a version for myself without ads.
    More details under the cut.

    1. Server settings for images.


    We need any web server with PHP support. The original server-side script is CGI, I decided to use PHP.

    The script itself is here:



    Apparently, nothing supernatural.

    When you try to send a file by the program, the script renames it a character set (uniqueness - md5 + time ()), and also returns a link to the screenshot.

    I decided to put the images not in the same folder, but in the i / folder, to which I assigned the rights 777.

    2. Preparation of the client part.


    2.1 Windows application


    The Windows application is written in C ++, an indication of which image server to use is written directly in the program code. In order not to recompile each time, I decided to take as a basis the version of gyazowin from paulirish , in which the settings are taken from the ini-file.

    ; Set up gyazo on your own server using 
    ;   ruby: http://github.com/gyazo/Gyazo/tree/master/Server/ 
    ;   php : http://benalman.com/news/2009/10/gyazo-on-your-own-server/
    [Configuration]
    SERVER = gyazo.com
    PATH = /upload.cgi
    

    Since his code did not want to work right away, I tweaked it a little.

    You can download the already compiled version with the ini-file here.

    To work with your server, in the config you must specify:

    [Configuration]
    SERVER = [ваш домен] - просто с ip-адресом у меня не заработало
    PATH = /upload.php - путь до вашего серверного скрипта
    

    You can also take the original application , and tweak it for yourself. (find the lines SERVER and PATH in the gyazowin.cpp file and replace as above)

    2.2 Mac OS application


    With the Mac version, everything is simpler - an external file is already used there, where the path to the server is stored.

    You must install Gyazo for Mac from the official website , then edit the script file, which is located in /Applications/Gyazo.app/Contents/Resources/ as follows:
    HOST = 'your domain'
    CGI = '/upload.php' - путь до вашего скрипта
    

    Then continue the work as usual.

    2.3 Linux - application


    Gyazo for Linux installation instructions .

    The path to the server, respectively, also needs to be changed in the ruby ​​script.

    And what, did you win anything?


    imageInstant work speed
    imageLack of advertising
    imageAll the screenshots you create are right at your side
    imageYou need to think about free space on the server (for a year I used about 200MB, which is generally not a lot for single use)
    imageYour friends are unlikely to want to use your solution, because they are afraid that you will have access to their images

    Example


    You can evaluate the speed of work on my server (I hope it does not bend under the habraeffect):
    http://vps.yurganov.ru/gyazo/
    Attention: all created screenshots are deleted by cron once every 5 minutes.

    PS File Gallery


    A gallery that shows all your downloaded files in chronological order is located here .

    Download: http://vps.yurganov.ru/gyazo/distr/gallery.zip .

    (Installation instructions inside the archive)

    Also popular now: