我有一个Python脚本,做一些操作上的JPEG图像。我传递一些参数,这个脚本,并从我的HTML页面调用它。该脚本返回一个IMG SRC =newimage.jpg标签。
I have a Python script that is doing some manipulation on a JPEG image. I pass some parameters to this script and call it from my HTML page. The script returns an img src="newimage.jpg tag.
我知道如何等待剧本的答复,但我不知道如何告诉当图像完全加载(当它是,我想要显示它)。图像加载缓慢,因此用户是看到这个加载过程中我现在得到的是。相反,我希望有一个味精告诉用户,而图像加载等待,才把我想要显示的图像。
I know how to wait for the reply from the script but I don't know how to tell when the image is fully loaded (when it is, I want to display it). What I get now is the image loading slowly so the user is seeing this "loading" process. Instead, I want to have a msg telling the user to wait while the image is loading, only then I want to display the image.
您可以动态地创建一个新的形象,结合东西,它的加载事件,并设置源:
You can dynamically create a new image, bind something to its load event, and set the source:
$('<img>').bind('load', function() {
$(this).appendTo('body');
}).attr('src', image_source);