“TagHim” Image Tagging Tool v4.0 Installation and Technical description (PHP/MYSQL)
“TagHim” Image Tagging Tool the most simple way of multi-object tagging on picture in your notes.
“TagHim” for PHP, MySQL, JavaScript, Ajax.
Required libraries (inclusive to the release):
- Prototype JavaScript framework, version 1.6.0.1 +,
- script.aculo.us scriptaculous.js v1.8.1 +
! IMPORTANT
If you are using library jQuery you have to set it to non conflict mode:
jQuery.noConflict();<link rel="stylesheet" href="css/cropper.css" type="text/css" />
<script src="js/prototype.js" type="text/javascript"></script>
<script src="js/scriptaculous.js?load=builder,effects,dragdrop" type="text/javascript"></script>
<script src="taghim/tagging.js?load=zoomer,labels,border,nameslist,reenter" type="text/javascript"></script>
CREATE TABLE tag (
id INT(11) AUTO_INCREMENT,
image_id INT(11) NOT NULL,
x0 INT(11) NOT NULL,
y0 INT(11) NOT NULL,
x1 INT(11) NOT NULL,
y1 INT(11) NOT NULL,
name VARCHAR(255) NOT NULL,
description TEXT DEFAULT NULL,
color VARCHAR(20) DEFAULT NULL,
id_account BIGINT(20) DEFAULT NULL,
email VARCHAR(100) DEFAULT NULL,
PRIMARY KEY (id)
)
ENGINE = INNODB
CHARACTER SET latin1 COLLATE latin1_swedish_ci;
<script src="js/prototype.js" type="text/javascript"></script>
<script src="js/scriptaculous.js?load=builder,effects,dragdrop" type="text/javascript"></script>
<script src="taghim/tagging.js?load=zoomer,labels,border,nameslist,reenter" type="text/javascript"></script>
<link rel="stylesheet" href="css/cropper.css" type="text/css" />
Object initialization
var {VARIABLE} = new tagging(
'{VARIABLE}',
'{REGISTER CODE HERE}',
'{IMAGE HTML ID}',
'{IMAGE UNIQUE NUMBER}',
{
'{OPTION}' : '{OPTION VALUE}'[,
...]
}
);
Announcing variable {VARIABLE}, where we saving object “tagging”:
var taghim = new tagging(
'taghim',
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
'cropp',
3,
{
ajaxRequestURL : 'tag.php',
ajaxReturnID : 'ret',
showDescription : true,
autoInit : false,
displayOnInit : false,
applyColors: true,
minWidth : 50,
minHeight : 50
}
);
Properties and Object methods
Properties
Example:
alert( [object].Version ); Example:
[object].errorFunction = function( sErrorText ){ alert( sErrorText ); }; { okButton : 'OK', cancelButton : 'Cancel', nameText : 'Name', descriptionText : 'Description' }Example:
[object].captions['okButton'] = 'Save';
Methods
Example:
[object].setOptions( { showTagsOnImage : true, minWidth : 40, minHeight : 30 } ); So option showTagsOnImage set to enable will show all tags on script initialization, by default it set to false, minWidth – minimum width for tagging area 40px пїЅ minHeight – minimum height for tagging area 30px.
Example:
[object].setOption( 'ajaxReturnID', 'DivRoReturnData' ); This function will set to the valuable ajaxReturnID the value ‘DivRoReturnData’.
Example:
[object].init( '#00FF00' ); пїЅпїЅпїЅ [object].init( 'green' );
Example:
[object].editTag( 101 ); or [object].editTag( '48' );it will send comand to edit tags with id = 101 or 48
Example:
[object].deleteTag( 101 ); or [object].editTag( '48' );Delete tags with id = 101 or 48
Example:
[object].hideTag();To hide all tags
- id – int value. Unic identificator (tag ID)
- x0 – int value. start x coordinate in pixels
- x1 – int value. end x coordinate in pixels
- y0 – int value. start y coordinate in pixels
- y1 – int value. end y coordinate in pixels
- descr – string value. This is tag description, enabled if coresponded mode is on (see. Object configuration)
- color – string value. Tab border color(see. Object configuration)
- name – string value. Tag name.
- additions – object value. Additional tags settings and tag values, for plugin use
Example:
[object].registerTag( 101, 10, 35, 30, 90, '', 'red', 'Some tag name', { 'user' : '20' } );
Here we registering tag with width starting at 10th to 35th pixel and height from 30th to 90th pixel, without text description, red border color with name ‘Some tag name’ and one additional paramieter ‘user’ which has value ‘20′
Example:
[object].unregisterTag( 10 ); Example:
[object].clearTagsList(); Example:
[object].getTagsList();
Example:
[object].getTagInfo( 21 ); Example:
[object].getCurrentTag(); Example:
[object].showTags(); Example:
[object].close();
Object configuration
- 1. During object initialization.(see. Object initialization)
- 2. By setting option array setOptions setOptions(see. Object Methods)
- 3. By setting option by option with method setOption setOption(see. Object Methods)
| Option name | Value | Default value | Description |
| ajaxRequestURL | String | null | Required function. Path to PHP or ASP script |
| ajaxReturnID | String | null | Required function. Should have element ID where will be returned result from PHP or ASP script. |
| style | String | imgTag_ | CSS prefix for custom design settings. |
| applyColors | true/false | false | Allowing or disallowing custom background tagging color |
| backgroundColor | String (Color in HTML format) | null | Set custom background color. |
| autoInit | true/false | false | Turn on/off autostart for tagging routine |
| displayOnInit | true/false | false | Turn on/off auto-display of border for tagged elements |
| showDescription | true/false | false | Turn on/off additional description for tags. |
| ratioDim | object { x : 0, y : 0 } | { x : 0, y : 0 } | Tagging area ratio, the (x:0, y:0) – ration is disabled. |
| minWidth | Integer | 0 | Min value for width. 0 – is disabled. |
| minHeight | Integer | 0 | Min value for height . 0 – is disabled. |
| maxWidth | Integer | 0 | Max value for width. 0 – is disabled |
| maxHeight | Integer | 0 | Max value for height . 0 – is disabled. |
| margin | Integer | 10 | Margin (px) between tag and working zone |
| onTagClick | function | null | This fuction run upon mous click on tag. It has tag id automaticaly. |
and have a pleasant tagging
![]()
What to do now?
TagHim Demo page TagHim