silverstripe-cms/javascript/ImageEditor/Image.js
Ingo Schommer 31a9fbee3c mujma: Fixed various browser compatibility problems. Now should work on Safari 3.0.2 /Windows, FF 1.5/2.0 Windows/Linux.
(merged from branches/gsoc)


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@41891 467b73ca-7a2a-4603-9d3b-597d59a354a9
2007-09-15 01:19:43 +00:00

31 lines
1.0 KiB
JavaScript

/**
* @author Mateusz
*/
var Image = {
initialize: function(imageFile) {
this.image = $('image');
this.image.src = imageFile;
this.reportSize = Image.reportSize.bind(this);
this.onImageLoad = Image.onImageLoad.bind(this);
Event.observe(this.image,'load',this.onImageLoad);
imageHistory.add('initialize',this.image.src);
},
reportSize: function() {
$('imageWidth').innerHTML = this.image.width + "px";
$('imageHeight').innerHTML = this.image.height + "px";
},
onImageLoad: function(event) {
this.reportSize();
$('imageContainer').style.width = this.image.width + 'px';
$('imageContainer').style.height = this.image.height + 'px';
if(resize.imageContainerResize.originalHeight == 0 && resize.imageContainerResize.originalWidth == 0) {
imageBox.center();
}
resize.imageContainerResize.originalWidth = this.image.width;
resize.imageContainerResize.originalHeight = this.image.height;
imageBox.checkOutOfDrawingArea($('imageContainer').getWidth(),$('imageContainer').getHeight());
}
};