{"action":"created","comment":{"url":"https://api.github.com/repos/optrv/Image-Resizer-Web/pulls/comments/73877333","id":73877333,"diff_hunk":"@@ -0,0 +1,80 @@\n+#!/usr/bin/env python3\n+import cgi, os\n+from PIL import Image\n+\n+print(\"Content-type: text/html\")\n+print(\"<meta charset=\\\"utf-8\\\">\")\n+print()\n+print(\"<style>h1,p{text-align:center;}</style>\")\n+\n+# Get the data\n+field = cgi.FieldStorage()\n+path_in = field.getfirst(\"path_in\")\n+width = field.getfirst(\"width\")\n+path_out = field.getfirst(\"path_out\")\n+path_water = field.getfirst(\"path_water\")\n+pos_water = field.getfirst(\"pos_water\")\n+\n+# Check if options are exist\n+if path_in is None:\n+    path_in = \"/Users/garazd/Documents/Python/Img_In/\"\n+if path_out is None:\n+    path_out = \"/Users/garazd/Documents/Python/Img_Out/\"\n+if width is None:\n+    width = 600\n+if path_water is None:\n+    path_water = \"/Users/garazd/Documents/Python/Watermark/\"\n+if pos_water is None:\n+    pos_water = 4 # The default value of watermark position — right below\n+\n+folder_in = os.listdir(path_in)\n+folder_water = os.listdir(path_water)\n+\n+# Watermark adding with specified (or default) value of position on image\n+def watermark(image_out, pos_water):\n+    for files in folder_water:\n+        if files.endswith('png') or files.endswith('jpg'):\n+            water = Image.open(os.path.join(path_water, files))\n+            if water.mode != 'RGBA':\n+                water = water.convert('RGBA')\n+            water = water.resize((image_out.size[0] // 4, \\\n+            int((image_out.size[0] // 4 * water.size[1]) // water.size[0])), Image.BILINEAR)\n+            layer = Image.new('RGBA', image_out.size, (0, 0, 0, 0))\n+            place = {1: (10, 10), 2: (image_out.size[0] - 10 - water.size[0], 10), 3: (10, \\\n+                    image_out.size[1] - 10 - water.size[1]), 4: (image_out.size[0] - 10 - \\\n+                    water.size[0], image_out.size[1] - 10 - water.size[1])}\n+            pos_water = (place[int(pos_water)])\n+            layer.paste(water,(pos_water))\n+            image_out = Image.composite(layer, image_out, layer)\n+            break # Just first one watermark image in the specified folder\n+    return image_out\n+\n+print()\n+for image_in in folder_in:\n+    if not image_in.startswith('.') and image_in != 'Thumbs.db':","path":"cgi-bin/image_resizer_web.py","position":54,"original_position":54,"commit_id":"505459be63a636d628a187944f795140b3c5943f","original_commit_id":"505459be63a636d628a187944f795140b3c5943f","user":{"login":"val-sytch","id":20322229,"avatar_url":"https://avatars.githubusercontent.com/u/20322229?v=3","gravatar_id":"","url":"https://api.github.com/users/val-sytch","html_url":"https://github.com/val-sytch","followers_url":"https://api.github.com/users/val-sytch/followers","following_url":"https://api.github.com/users/val-sytch/following{/other_user}","gists_url":"https://api.github.com/users/val-sytch/gists{/gist_id}","starred_url":"https://api.github.com/users/val-sytch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/val-sytch/subscriptions","organizations_url":"https://api.github.com/users/val-sytch/orgs","repos_url":"https://api.github.com/users/val-sytch/repos","events_url":"https://api.github.com/users/val-sytch/events{/privacy}","received_events_url":"https://api.github.com/users/val-sytch/received_events","type":"User","site_admin":false},"body":"I remember that Kostya told about these lines. What will have happen if in that folder your script find pdf, zip or rar files?","created_at":"2016-08-08T13:47:13Z","updated_at":"2016-08-08T13:47:13Z","html_url":"https://github.com/optrv/Image-Resizer-Web/pull/1#discussion_r73877333","pull_request_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/optrv/Image-Resizer-Web/pulls/comments/73877333"},"html":{"href":"https://github.com/optrv/Image-Resizer-Web/pull/1#discussion_r73877333"},"pull_request":{"href":"https://api.github.com/repos/optrv/Image-Resizer-Web/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/optrv/Image-Resizer-Web/pulls/1","id":80402587,"html_url":"https://github.com/optrv/Image-Resizer-Web/pull/1","diff_url":"https://github.com/optrv/Image-Resizer-Web/pull/1.diff","patch_url":"https://github.com/optrv/Image-Resizer-Web/pull/1.patch","issue_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/issues/1","number":1,"state":"open","locked":false,"title":"Image Resizer v.3.0 (alpha)","user":{"login":"optrv","id":20288408,"avatar_url":"https://avatars.githubusercontent.com/u/20288408?v=3","gravatar_id":"","url":"https://api.github.com/users/optrv","html_url":"https://github.com/optrv","followers_url":"https://api.github.com/users/optrv/followers","following_url":"https://api.github.com/users/optrv/following{/other_user}","gists_url":"https://api.github.com/users/optrv/gists{/gist_id}","starred_url":"https://api.github.com/users/optrv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/optrv/subscriptions","organizations_url":"https://api.github.com/users/optrv/orgs","repos_url":"https://api.github.com/users/optrv/repos","events_url":"https://api.github.com/users/optrv/events{/privacy}","received_events_url":"https://api.github.com/users/optrv/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-08-08T07:00:23Z","updated_at":"2016-08-08T13:47:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f442e1a828670636d049cc991f8f508af142e091","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/pulls/1/commits","review_comments_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/pulls/1/comments","review_comment_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/pulls/comments{/number}","comments_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/issues/1/comments","statuses_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/statuses/505459be63a636d628a187944f795140b3c5943f","head":{"label":"optrv:3.0(alpha)","ref":"3.0(alpha)","sha":"505459be63a636d628a187944f795140b3c5943f","user":{"login":"optrv","id":20288408,"avatar_url":"https://avatars.githubusercontent.com/u/20288408?v=3","gravatar_id":"","url":"https://api.github.com/users/optrv","html_url":"https://github.com/optrv","followers_url":"https://api.github.com/users/optrv/followers","following_url":"https://api.github.com/users/optrv/following{/other_user}","gists_url":"https://api.github.com/users/optrv/gists{/gist_id}","starred_url":"https://api.github.com/users/optrv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/optrv/subscriptions","organizations_url":"https://api.github.com/users/optrv/orgs","repos_url":"https://api.github.com/users/optrv/repos","events_url":"https://api.github.com/users/optrv/events{/privacy}","received_events_url":"https://api.github.com/users/optrv/received_events","type":"User","site_admin":false},"repo":{"id":65178805,"name":"Image-Resizer-Web","full_name":"optrv/Image-Resizer-Web","owner":{"login":"optrv","id":20288408,"avatar_url":"https://avatars.githubusercontent.com/u/20288408?v=3","gravatar_id":"","url":"https://api.github.com/users/optrv","html_url":"https://github.com/optrv","followers_url":"https://api.github.com/users/optrv/followers","following_url":"https://api.github.com/users/optrv/following{/other_user}","gists_url":"https://api.github.com/users/optrv/gists{/gist_id}","starred_url":"https://api.github.com/users/optrv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/optrv/subscriptions","organizations_url":"https://api.github.com/users/optrv/orgs","repos_url":"https://api.github.com/users/optrv/repos","events_url":"https://api.github.com/users/optrv/events{/privacy}","received_events_url":"https://api.github.com/users/optrv/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/optrv/Image-Resizer-Web","description":null,"fork":false,"url":"https://api.github.com/repos/optrv/Image-Resizer-Web","forks_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/forks","keys_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/keys{/key_id}","collaborators_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/teams","hooks_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/hooks","issue_events_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/issues/events{/number}","events_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/events","assignees_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/assignees{/user}","branches_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/branches{/branch}","tags_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/tags","blobs_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/git/refs{/sha}","trees_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/git/trees{/sha}","statuses_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/statuses/{sha}","languages_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/languages","stargazers_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/stargazers","contributors_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/contributors","subscribers_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/subscribers","subscription_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/subscription","commits_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/commits{/sha}","git_commits_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/git/commits{/sha}","comments_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/comments{/number}","issue_comment_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/issues/comments{/number}","contents_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/contents/{+path}","compare_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/compare/{base}...{head}","merges_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/merges","archive_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/downloads","issues_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/issues{/number}","pulls_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/pulls{/number}","milestones_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/milestones{/number}","notifications_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/labels{/name}","releases_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/releases{/id}","deployments_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/deployments","created_at":"2016-08-08T06:34:34Z","updated_at":"2016-08-08T06:34:34Z","pushed_at":"2016-08-08T07:00:23Z","git_url":"git://github.com/optrv/Image-Resizer-Web.git","ssh_url":"git@github.com:optrv/Image-Resizer-Web.git","clone_url":"https://github.com/optrv/Image-Resizer-Web.git","svn_url":"https://github.com/optrv/Image-Resizer-Web","homepage":null,"size":48,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"optrv:master","ref":"master","sha":"e5a31e3c593e64abb8f1358d5486dba392eb8ab6","user":{"login":"optrv","id":20288408,"avatar_url":"https://avatars.githubusercontent.com/u/20288408?v=3","gravatar_id":"","url":"https://api.github.com/users/optrv","html_url":"https://github.com/optrv","followers_url":"https://api.github.com/users/optrv/followers","following_url":"https://api.github.com/users/optrv/following{/other_user}","gists_url":"https://api.github.com/users/optrv/gists{/gist_id}","starred_url":"https://api.github.com/users/optrv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/optrv/subscriptions","organizations_url":"https://api.github.com/users/optrv/orgs","repos_url":"https://api.github.com/users/optrv/repos","events_url":"https://api.github.com/users/optrv/events{/privacy}","received_events_url":"https://api.github.com/users/optrv/received_events","type":"User","site_admin":false},"repo":{"id":65178805,"name":"Image-Resizer-Web","full_name":"optrv/Image-Resizer-Web","owner":{"login":"optrv","id":20288408,"avatar_url":"https://avatars.githubusercontent.com/u/20288408?v=3","gravatar_id":"","url":"https://api.github.com/users/optrv","html_url":"https://github.com/optrv","followers_url":"https://api.github.com/users/optrv/followers","following_url":"https://api.github.com/users/optrv/following{/other_user}","gists_url":"https://api.github.com/users/optrv/gists{/gist_id}","starred_url":"https://api.github.com/users/optrv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/optrv/subscriptions","organizations_url":"https://api.github.com/users/optrv/orgs","repos_url":"https://api.github.com/users/optrv/repos","events_url":"https://api.github.com/users/optrv/events{/privacy}","received_events_url":"https://api.github.com/users/optrv/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/optrv/Image-Resizer-Web","description":null,"fork":false,"url":"https://api.github.com/repos/optrv/Image-Resizer-Web","forks_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/forks","keys_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/keys{/key_id}","collaborators_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/teams","hooks_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/hooks","issue_events_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/issues/events{/number}","events_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/events","assignees_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/assignees{/user}","branches_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/branches{/branch}","tags_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/tags","blobs_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/git/refs{/sha}","trees_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/git/trees{/sha}","statuses_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/statuses/{sha}","languages_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/languages","stargazers_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/stargazers","contributors_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/contributors","subscribers_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/subscribers","subscription_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/subscription","commits_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/commits{/sha}","git_commits_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/git/commits{/sha}","comments_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/comments{/number}","issue_comment_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/issues/comments{/number}","contents_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/contents/{+path}","compare_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/compare/{base}...{head}","merges_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/merges","archive_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/downloads","issues_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/issues{/number}","pulls_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/pulls{/number}","milestones_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/milestones{/number}","notifications_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/labels{/name}","releases_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/releases{/id}","deployments_url":"https://api.github.com/repos/optrv/Image-Resizer-Web/deployments","created_at":"2016-08-08T06:34:34Z","updated_at":"2016-08-08T06:34:34Z","pushed_at":"2016-08-08T07:00:23Z","git_url":"git://github.com/optrv/Image-Resizer-Web.git","ssh_url":"git@github.com:optrv/Image-Resizer-Web.git","clone_url":"https://github.com/optrv/Image-Resizer-Web.git","svn_url":"https://github.com/optrv/Image-Resizer-Web","homepage":null,"size":48,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/optrv/Image-Resizer-Web/pulls/1"},"html":{"href":"https://github.com/optrv/Image-Resizer-Web/pull/1"},"issue":{"href":"https://api.github.com/repos/optrv/Image-Resizer-Web/issues/1"},"comments":{"href":"https://api.github.com/repos/optrv/Image-Resizer-Web/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/optrv/Image-Resizer-Web/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/optrv/Image-Resizer-Web/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/optrv/Image-Resizer-Web/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/optrv/Image-Resizer-Web/statuses/505459be63a636d628a187944f795140b3c5943f"}}}}
{"actor":{"display_login":"val-sytch"}}