User:Codehydro/Auto CSS image crop: Difference between revisions

Content deleted Content added
new feature: import
max in bSize
 
(4 intermediate revisions by the same user not shown)
Line 8:
<code>importScript('User:Codehydro/Auto CSS image crop/script.js');</code>
 
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 <code>DisableAutoCropEverywhere = true;</code> 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 [[User:Codehydro/Auto CSS image crop/script.js|script.js]]) and execute it either in your URL bar, in the JavaScript console, or via a [[bookmarklet]] (just Google it).
 
Alternatively, you may simply copy the above line (or the contents of [[User:Codehydro/Auto CSS image crop/script.js|script.js]] and [[User:Codehydro/Auto CSS image crop/functions.js|functions.js]]) and execute it either in your URL bar, in the JavaScript console, or via a [[bookmarklet]] (just Google it).
== Usage ==
Enter the file name (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.
 
== Usage ==
When in the cWidth, cHeight, oTop, and oLeft fields, you can press the up/down arrow keys to increase/decrease the field's value by 1% of bSize.
=== Quick Start ===
Enter the file''Image'' namefile (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 field values by pasting existing {{t|CSS image crop}} templates into the import''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.
 
=== Check ===
Line 35 ⟶ 36:
|oLeft = 60
}}</pre>
 
=== Advanced ===
When* in the cWidth, cHeight, oTop, and oLeft fields, you can pressPress the up/down arrow keys to increase/decrease the field's value by 1% of bSize when in the cWidth, cHeight, oTop, and oLeft fields.
* Click opposite corners of the area you wish to frame and a guide lines will appear. Finalize crop using the "Crop to clicked" button.
* Undo clicks by holding "shift" and click on the image.
* Set cWidth or cHeight field to ">###" and your current crop will be scaled to such that cWidth or cHeight will be "###". Alternatively, you can set the field value to "1>3" or "2>1" and all fields will multiplied by a factor of 3 or divided by 2, respectively.
* Type "max" anywhere in the bSize field and the native width of the image file (max bSize allowed) will be automatically loaded upon clicking out of the field.