User:Codehydro/Auto CSS image crop
From Wikipedia, the free encyclopedia
From Wikipedia, the free encyclopedia
This tool is designed to help editors use {{CSS image crop}} to crop images.
To implement this, add this to your common.js page (or any skin works fine):
importScript('User:Codehydro/Auto CSS image crop/script.js');
In addition to activating this page, new button "Open Auto CSS image crop" will be available on the far right of the editing toolbar to provide quick access to this tool on other pages. If you do not want this button, simply add DisableAutoCropEverywhere = true;
before the the importScript line. The tool will still automatically load on this page.
Alternatively, you may simply copy the above line (or the contents of script.js and functions.js) and execute it either in your URL bar, in the JavaScript console, or via a bookmarklet (just Google it).
Enter the Image file (e.g. Dew on grass Luc Viatour.jpg) and a bSize value. Once both of these are entered press tab or click outside of the form and a preview of your image will automatically appear. Adjust cWidth/cHeight in the form to change how the image is cropped. Change oTop/oLeft or use the scroll bars to position your image. You may change the bSize and the script will resize the image while preserving the crop position. The source code will automatically be generated below the input.
You can also populate values by pasting existing {{CSS image crop}} templates into the Import field (click out to finalize). If the pasted template contains parameters not covered this tool (e.g. Location or Description), the generator will attempt to preserve them in the output code.
To make sure the generator works properly on your browser, copy the following into the import field and see if it looks just like the image pictured above:
{{CSS image crop |Image = Dew on grass Luc Viatour.jpg |bSize = 400 |cWidth = 100 |cHeight = 100 |oTop = 180 |oLeft = 60 }}
Seamless Wikipedia browsing. On steroids.
Every time you click a link to Wikipedia, Wiktionary or Wikiquote in your browser's search results, it will show the modern Wikiwand interface.
Wikiwand extension is a five stars, simple, with minimum permission required to keep your browsing private, safe and transparent.