//上传完图片后触发函数
function TransValue(filename)
{
var imgsrc = "/ImageOfArticle/" + filename;
var img1 = new EnhancedImage(imgsrc,onImageLoad);
img1.load();
}
//预加载图片
function EnhancedImage(src,onLoaded){
var self = this;
this.src = src;
this.width = 0;
this.height = 0;
this.onLoaded = onLoaded;
this.loaded = false;
this.image = null;
this.load = function(){
if(this.loaded)
return;
this.image = new Image();
this.image.src = this.src;
var SnowWolfInterval = setInterval(loadImage,100);
function loadImage()
{
if(self.width != 0 && self.height != 0)
{
clearInterval(SnowWolfInterval);
self.loaded = true;
self.onLoaded(self);//将实例传入回调函数
}
self.width = self.image.width;//是number类型
self.height = self.image.height;
} }
}
//将图片添加到编辑器
function onImageLoad(NewImage){
var oEditor = FCKeditorAPI.GetInstance("FCKeditor1");
oEditor.InsertElement(NewImage.image);
}
function TransValue(filename)
{
var imgsrc = "/ImageOfArticle/" + filename;
var img1 = new EnhancedImage(imgsrc,onImageLoad);
img1.load();
}
//预加载图片
function EnhancedImage(src,onLoaded){
var self = this;
this.src = src;
this.width = 0;
this.height = 0;
this.onLoaded = onLoaded;
this.loaded = false;
this.image = null;
this.load = function(){
if(this.loaded)
return;
this.image = new Image();
this.image.src = this.src;
var SnowWolfInterval = setInterval(loadImage,100);
function loadImage()
{
if(self.width != 0 && self.height != 0)
{
clearInterval(SnowWolfInterval);
self.loaded = true;
self.onLoaded(self);//将实例传入回调函数
}
self.width = self.image.width;//是number类型
self.height = self.image.height;
} }
}
//将图片添加到编辑器
function onImageLoad(NewImage){
var oEditor = FCKeditorAPI.GetInstance("FCKeditor1");
oEditor.InsertElement(NewImage.image);
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货