{ "info": { "author": "Sean Macdonald", "author_email": "sean.macdonald@stjoseph.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable" ], "description": "# sizeify-client\r\n\r\nOfficial clients for Sizeify B.\r\n\r\n## Build Status\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n
BranchBuild
master
\r\n\r\n## What is Sizeify B?\r\n\r\nSizeify is an image resizing service. It takes the URL of an image, and a code representing how it should be resized. It then caches (for a month) and serves the image effiently from Edge locations. It is a useful tool for developers who wish to support designers who change their mind a lot.\r\n\r\nSizeify A is crappy and should not be used. \r\n\r\n## Installation\r\n\r\nClone this repo and pull out the files you need, or:\r\n\r\n```html\r\n\r\n```\r\n\r\n```bash\r\n$ npm install @sean9999/sizeify-client\r\n```\r\n\r\nor:\r\n\r\n```shell\r\n$ bower install sizeify\r\n```\r\n\r\nor:\r\n\r\n```bash\r\n$ composer require sjc/sizeify\r\n```\r\n\r\nor:\r\n\r\n```shell\r\n$ pip install sizeify\r\n```\r\n\r\nor:\r\n\r\n```bash\r\n$ pip3 install sizeify\r\n```\r\n\r\n## How do you use sizeify?\r\n\r\nThere are two ways:\r\n\r\n```\r\nsizeify($endpoint,$imageUrl,$resizeCode)\r\n```\r\n\r\nor:\r\n\r\n```\r\nsizeify($imageUrl,$resizeCode)\r\n```\r\n\r\nwhere `$endpoint` is something like *http://sizeifyb.sjc.io* and `$imageUrl` is a fully qualified absolute URL like *http://www.linux.org/images/linux_org.png*, and `$resizeCode` is like:\r\n\r\n\r\nExample | What it does\r\n--- | --- \r\nw200 | resizes the width to 200, preserving aspect ratio\r\nh150 | resizes the height to 200, preserving aspect ratio\r\n50x75\t| sizes the width to 50, and height to 75 (destroying aspect ratio)\r\nl500\t| resizes the image along it's longest dimension to 500.\r\ns300\t| resizes the image along it's shortest dimension to 300.\r\np110\t| creates a square 110x110. White padding is used to maintain aspect ratio\r\nb110\t| same, but with black padding\r\ng110\t| same, but with gray padding\r\nc200\t| creates a square 200x200, cropping the image to preserve aspect ratio\r\n\r\nHere is an Angular example: http://plnkr.co/edit/IM3xjJjErSfSYwenwott?p=preview\r\n\r\n## What are the various endpoints?\r\n\r\nEndpoint | Origin Server | Feature\r\n--------- | ------------ | -------\r\nsizeifyb.sjc.io\t| sizeify.origin.b.sjc.io | Default endpoint. medium compression\r\nsizeifyb-lowres.sjc.io\t| sizeify.origin.cq.50.b.sjc.io | Low res\r\nsizeifyb-hq.sjc.io\t| sizeify.origin.cq.100.b.sjc.io\t| High res\r\nsizeifyb-snow.sjc.io\t| sizeify.origin.snow.b.sjc.io\t| Medium compression. PNGs with trasparency are given a white background.\r\n\r\n## Architecture\r\n\r\nDepending on the amount of compression you want, you can use one of several endpoints, as described here. The red images represent CDN distributions, and they are the official endpoints. The orange squares describe the origin servers. The fourth enpoint is suitable for testing. It bypasses the CDN altogether and does no caching.\r\n\r\n\"sizeify\r\n\r\n## Advanced Usage\r\n\r\nIn addition to supporting the GET method, appropriate for using directly in `` tags, sizeify also supports:\r\n\r\nVerb | What it does | Why it could be useful\r\n--------- | ------------ | -------\r\nPOST\t| Creates the cache\t| Useful in scripts that do not want to reveice binary (image) data in response. Will return appropriate HTTP status codes if there was an error\r\nHEAD\t| Obtains meta information | Returns meta information of the object as an image (width,height,mime-type) and as a cache record (timestamp,TTL). HEAD returns 404 if the record does not exist, therefore HEAD has no side effects. GET, in contrast, creates records if they do not exist. It is important to note that this behaviour contravenes strict RESTful principals.\r\nDELETE (against a variant)*\t| Deletes the object\t| Deletes the object if it exists. This is not instant. It triggers a \"cache invalidation\" request that is executed eventually on the CDN. The corresponding object deletion on the origin server is takes place immediately, but clients will see stale data for several minutes.\r\nDELETE (against a folder)*\t| Deletes all variants\t| If you uploaded the wrong image and want to remove all traces, you want this.\r\n\r\n*NOTE: [Deletes are expensive](https://twitter.com/codinghorror/status/506010907021828096). The best way to handle new data is to upload it to new enpoints and create new records on sizeify. Old data removes itself naturally after a month.\r\n\r\n## Sizeify HTTP API \r\n\r\nSizeify server exposes a single endpoint accepting GET, POST, HEAD and DELETE as described above.\r\n\r\nThe format of the endpoint is `////`\r\n\r\n### Constructing a valid Sizeify request\r\n\r\nYou wish to size a picture of a cat obtained from PlaceKitten to 50 pixels wide. The PlaceKitten url is http://placekitten.com/1000 and the Sizeify URL is http://sizeifyb.sjc.io.\r\n\r\n1. sizeify-host: `http://sizeifyb.sjc.io` - see above\r\n2. scheme-of-url-to-size: `http` - **http**://placekitten.com\r\n1. Reverse the placekitten host `com.placekitten` - http://**placekitten.com**\r\n2. Size param: `w50` - see above\r\n3. Path to image from PlaceKitten URL: `1000` - http://placekitten.com/**1000** \r\n4. Put it all together with slash separators: `http://sizeifyb.sjc.io/http/com.placekitten/w50/1000`\r\n\r\n### Testing Sizeify with cURL\r\n\r\nUsing the above URL as an example we can cURL Sizeify as `curl -o/c/temp/mykitten.jpg http://sizeifyb.sjc.io/http/com.placekitten/w50/1000`. This will size and download the image to your local filesystem at C:\\temp\\mykitten.jpg.\r\n\r\n### Testing Sizeify with PostMan\r\n\r\nIf you have [PostMan](https://chrome.google.com/webstore/detail/postman-rest-client/fhbjgbiflinjbdggehcddcbncdddomop) installed you can import the PostMan collection found in the test folder of the sizeify-client Github project.", "description_content_type": null, "docs_url": "https://pythonhosted.org/sizeify/", "download_url": "https://github.com/stjosephcontent/sizeify-client/archive/v1.2.0.zip", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://sizeifyb.sjc.io", "keywords": "image,resize,cdn", "license": "UNKNOWN", "maintainer": "Sean Macdonald", "maintainer_email": "sean.macdonald@stjoseph.com", "name": "sizeify", "package_url": "https://pypi.org/project/sizeify/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/sizeify/", "project_urls": { "Download": "https://github.com/stjosephcontent/sizeify-client/archive/v1.2.0.zip", "Homepage": "http://sizeifyb.sjc.io" }, "release_url": "https://pypi.org/project/sizeify/1.2.0/", "requires_dist": null, "requires_python": null, "summary": "official client for sizeify, the image resizing and hosting service", "version": "1.2.0" }, "last_serial": 2477403, "releases": { "1.1.2": [ { "comment_text": "", "digests": { "md5": "05005d447596c4e08b138223de595a52", "sha256": "6faeb6c13e44c6b17b0aeb822794cb3b99d9ecc65d9bbcd1bc4d77bc478c7b0c" }, "downloads": -1, "filename": "sizeify-1.1.2.tar.gz", "has_sig": false, "md5_digest": "05005d447596c4e08b138223de595a52", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3517, "upload_time": "2015-10-21T13:35:54", "url": "https://files.pythonhosted.org/packages/20/86/b38b8866919f4651d4cd4b2414f7d7f392db2acf7a96730dd9863bcfd5a4/sizeify-1.1.2.tar.gz" } ], "1.2.0": [] }, "urls": [] }