Giter Site home page Giter Site logo

bawolff / croptool Goto Github PK

View Code? Open in Web Editor NEW

This project forked from danmichaelo/croptool

0.0 0.0 0.0 1.54 MB

Tool for cropping images at Wikimedia Commons and other Wikimedia wikis

License: Other

Shell 0.21% JavaScript 15.15% Python 0.68% PHP 67.55% CSS 1.55% HTML 14.52% Dockerfile 0.33% Procfile 0.01%

croptool's Introduction

CropTool

CropTool is a tool for cropping image files at Wikimedia Commons and other Wikimedia sites using the MediaWiki API with OAuth.

Features:

  • Supports JPEG, PNG and (animated) GIF files, and also single pages from DJVU and PDF files.
  • JPEGs can be cropped either losslessly using jpegtran or pixel perfect using ImageMagick.
  • Crop preview can be initialized from query string parameters: ?title=Example.jpg&left=10&top=10&width=150&height=100 or ?title=Example.jpg&left=10&top=10&right=10&bottom=10
  • Detects {{Remove border}}, Category:Images with borders, {{Watermark}} and {{Trimming}}, and provides check boxes for optional removal of these upon cropping.
  • The result can replace the original file or be uploaded as a new one.
  • If the result is uploaded as a new file on Wikimedia Commons,
  • Stops users from cropping images waiting for license review (having {{Flickrreview}} without any parameters, or some of the User:FlickreviewR subtemplates), since images should be reviewed before being altered.
  • Adds {{Orphaned non-free revisions}} when cropping non-free media on English Wikipedia.

Setting up a development environment

  1. Request an OAuth 1.0 consumer at https://meta.wikimedia.org/wiki/Special:OAuthConsumerRegistration/propose with
  • Callback URL: https://localhost:7878/
  • Allow consumer to specify a callback in requests
  • Grants: "Edit existing pages", "Create, edit, and move pages", "Upload new files" and "Upload, replace, and move files"
  1. Copy config.dev.ini to config.ini and add the consumer token and secret token to config.ini and check the default paths for the dependencies.

  2. Install dependencies using Composer and NPM:

docker compose run phpfpm composer install
npm install
  1. Build the frontend:
npx gulp build
  1. Generate secret for encrypted cookies:
docker compose run phpfpm php generate-key.php
  1. Start the development server on https://localhost:7878/
docker-compose up

Note that you should be able to login and preview cropping without waiting for the OAuth consumer to be accepted.

Deployment notes

  • Run toolforge build start <public link to repo>
  • Run toolforge webservice --backend=kubernetes --mount=all buildservice start
  • Copy config.prod.ini into the home directory, and add OAuth information
  • Creates a public_files directory in the home directory and set it to be readable and writable by others

croptool's People

Contributors

danmichaelo avatar simon04 avatar steinsplitter avatar wmde-fisch avatar anticompositenumber avatar edwardbetts avatar mwootten avatar scrutinizer-auto-fixer avatar sohomdatta1 avatar sikanderiqbal avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.