Upload image file or image URL to the ptpimg.me image hosting.
Using setup.py:
python setup.py installManually:
- Install python3 package
requests(usuallyapt-get install python3-requestsorpip3 install requests).- If you want clipboard support, install
pypercliptoo.
To find your PTPImg API key, login to https://ptpimg.me, open the page source (i.e. "View->Developer->View source" menu in Chrome), find the string api_key and copy the hexademical string from the value attribute. Your API key should look like 43fe0fee-f935-4084-8a38-3e632b0be68c.
You can export your ptpimg.me API key (usually in .bashrc or .zshenv) using:
export PTPIMG_API_KEY=<your hex key>or use the -k / --api-key command-line switch.
Run
pimgupme -hto get command-line help.
To upload an image file:
pimgupme ~/seed/mytorrent/folder.jpgTo rehost an imgur image:
pimgupme https://i.imgur.com/eaT6j3X.jpgAn uploaded URL will be printed to the console.
If --bbcode parameter is specified, URLS will be wrapped in BBCode [img] tags:
pimgupme --bbcode ~/seed/mytorrent/folder.jpgIf --thumbnails parameter is specified, thumbnails will be generated and uploaded, along with full size images,
with BBCode tags:
[url=fullsizeURL][img]thumbURL[/img[/url]
outputted accordingling.
My typical usage for sites where there is no image resizing available is
find ./ -maxdepth 1 -type f \( -iname \*.jpg -o -iname \*.png -o -iname \*.jpeg \) -print0 | xargs --null pimgupme.py --bbcode --thumbnails -k ptpimgAPIkeyCurrently --thumbnails doesn't support URLs in the xargs. This will be updated in the future. Necessary is to download images
from URLs, create thumbnails, and up both of them. Not hard, but I just don't need that. Future releases may support it if there is interest.
## Command Line Utility
I've included a small shell script to employ the command seen above. The bash shell script has the options as follow:
``` ParsePimGupMe v1.3.3 (octaLSD)
Usage: ./parseptpimg.sh [options]
- options: -t|--thumbs , create thumbnails with default 320 max scale
- -s|--size SIZE, this is an option like '--xlarge' or '--large' or '--max-scale 960', enclosed in quotes -h|--help, print this screen
## Clipboard copy
If pyperclip python package is installed, the URL will be additionally copied to the clipboard.
If output is a terminal, a bell will be ringed on completion (can be disabled with a --nobell parameter).
You can specify multiple files and URLs on the command line:
pimgupme ~/seed/mytorrent/folder.jpg https://i.imgur.com/eaT6j3X.jpgThe resulting URLs are printed each on separate line, and copied to your clipboard with newlines in between.
### Note
The paperclip option does not currently work when creating thumbnails. If you would like this extra feature, please open up a issue for a new feature and I'll see what I can do.
BSD
- mjpieters - a great refactoring and Python packaging
- theirix - for doing most of the heavy lifting