(This is a fork of Myazo - the intention of this is to send directly to a linx-server instead of using the included upload.php file)
Myazo is a self-hosted Gyazo alternative. It allows you to take a screenshot of part of your screen and automatically upload it to your own server.
It is comprised by a cross-platform client in Python which defers the actual taking of screenshot to OS built-in tools (macOS and Windows) or common utilities (GNU/Linux distributions). The server script, designed with cheap shared hosting in mind, is written with the ubiquitous PHP. Both the client and server are single files. You may separate the settings from the code if you wish.
It can also function as a mere Gyazo client, uploading directly to Gyazo's servers. In that case, you simply need the client and to set the configuration option gyazo_server
to True
. This mode won't send additional metadata like the Gyazo proprietary clients.
- Python >= 3.5 (check with
python --version
)
The following OSes have off-the-shelf compatibility. You can add more back ends for missing systems or configurations.
- GNU/Linux (presets for
gnome-screenshot
,xfce4-screenshooter
,spectacle
,scrot
andimport
(ImageMagick)) - macOS
- Windows 10 >= 1703 Creators Update (check with
winver
- Build >= 10.0.15063.251)
- Install Python 3 and choose the version matching your CPU arch (x86 or x86-64);
- Install client requirements:
pip install -r client/src/requirements.txt
If myazo_linx
is True
(you are wanting to send the image directly to a linx server, instead of sending it to wherever upload.php is):
- Enter in your linx-api-key in the variable
secret
inclient/src/myazo.py
; - Enter in the the full linx upload url in the variable
upload_script
inclient/src/myazo.py
; - On Windows: either run the myazo.py from a command line, or change extension to .pyw and double-click away.
- PHP >= 5.6 (check with
php -v
orphp -r "echo phpinfo();"
)
On some GNU/Linux distributions, pip3
is used for python3. If that's the case, swap pip
with pip3
in the command above.
- Choose or generate a secret key and fill in the variable
secret
atclient/src/myazo.py
; - Hash the secret key with bcrypt and fill in the variable
secretBcrypt
atserver/src/upload.php
; You can do so with PHP itself:
php -r "echo password_hash('yoursecrethere', PASSWORD_DEFAULT);"
If you don't have access to a php cli, create a hash.php
file on your web server with <?php file_put_contents(__FILE__, '<?php ' . password_hash('yoursecrethere', PASSWORD_DEFAULT));
and open it on your browser. Then, grab the hash from the hash.php
source and delete the file.
- Upload
server/src/upload.php
to your web server; - Disable directory listing so the list of uploaded screenshots isn't visible. For Apache, this can be done by uploading
server/src/.htaccess
to your web server's web root (or possibly any other directory, as long as it is a parent of the one where screenshots are stored). - Enter the full public url of the
server/src/upload.php
script in the variableupload_script
atclient/myazo.py
.
Alternatively, you may use the Docker and Docker Compose config files to deploy the server. Please note that you will need to configure HTTPS yourself.
There are two ways of configuring Myazo: either change the options in the scripts themselves, or use an external config file.
If an external file is found, Myazo extends the default config with the provided values. The following tables contain all options and where the user config file must be placed.
- Example Config:
client/src/config.ini.example
- Placement Path:
~/.config/myazo/config.ini
(~
refers to the user directory)
Key | Default | Description |
---|---|---|
gyazo_server | False | Controls whether to use Gyazo's servers |
gyazo_direct_link | True | Controls whether to open Gyazo direct image url |
myazo_linx | True | Controls whether to send to linx server directly |
upload_script | 'https://myazo.example.com/upload' | Full path to the linx Upload URL |
secret | 'hunter2' | Secret token |
clear_metadata | True | Controls clearing screenshot metadata before upload |
open_browser | True | Controls open url in default browser after upload |
copy_clipboard | True | Controls copy url to clipboard after upload |
output_url | True | Controls print url to stdout after upload |
Please note that if gyazo_server
is set to True
, upload_script
and secret
are ignored.
Also, gyazo_server
must be set to False
if myazo_linx
is set to True.
*** NOTE: NOT REQUIRED IF myazo_linx is set to True ***
- Example Config:
server/src/config.php.example
- Placement Path:
config.php
(relative toupload.php
)
Key | Default | Description |
---|---|---|
secretBcrypt | '' | Bcrypt hashed secret |
saveDirName | '/data/' | Writable directory where screenshots will be stored |
maxScreenshotSize | 2 * 1048576 | Maximum size in bytes of uploaded screenshot |
screenshotMimeType | 'image/png' | MIME type of uploaded screenshot |
Please note that maxScreenshotSize
may be capped externally by PHP and the web server.
- GNU/Linux
Make sure the file is executable by running chmod +x /path/to/myazo.py
.
~/.local/share/applications/myazo.desktop
[Desktop Entry]
Name=Myazo
Comment=Screenshot
Exec=/path/to/myazo.py
Terminal=false
Type=Application
Icon=applets-screenshooter
Categories=Utility;Graphics;
StartupNotify=false
- Windows
Rename myazo.py
to myazo.pyw
and create a new shortcut pointing to C:\path\to\myazo.pyw
. Optionally, you can change the icon to a more fitting and better looking one (shell32.dll
's scissors one is decent). You can then pin the shortcut to the taskbar or start menu.
MIT. See License.md
for further information.