我正在访问我的网站上的链接,每次访问时都会提供一个新图像.
我遇到的问题是,如果我尝试在后台加载图像然后更新页面上的图像,图像不会改变 - 虽然它在我重新加载页面时更新.
var newImage = new Image();
newImage.src = "http://localhost/image.jpg";
function updateImage()
{
if(newImage.complete) {
document.getElementById("theText").src = newImage.src;
newImage = new Image();
number++;
newImage.src = "http://localhost/image/id/image.jpg?time=" + new Date();
}
setTimeout(updateImage, 1000);
}
Run Code Online (Sandbox Code Playgroud)
FireFox看到它们的标题:
HTTP/1.x 200 OK
Cache-Control: no-cache, must-revalidate
Pragma: no-cache
Transfer-Encoding: chunked
Content-Type: image/jpeg
Expires: Fri, 30 Oct 1998 14:19:41 GMT
Server: Microsoft-HTTPAPI/1.0
Date: Thu, 02 Jul 2009 23:06:04 GMT
Run Code Online (Sandbox Code Playgroud)
我需要在页面上强制刷新该图像.有任何想法吗?
我在我的应用程序中设置了背景图像,但背景图像很小,我想重复它并填写整个屏幕.我该怎么办?
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/bg"
android:tileMode="repeat">
Run Code Online (Sandbox Code Playgroud) HTML
<img src="logo.svg" alt="Logo" class="logo-img">
Run Code Online (Sandbox Code Playgroud)
CSS
.logo-img path {
fill: #000;
}
Run Code Online (Sandbox Code Playgroud)
上面的svg加载并且是原生的,fill: #fff但是当我使用上面css的内容尝试将其更改为黑色时它不会改变,这是我第一次玩SVG而且我不确定它为什么不起作用.
在我的模型中,我有:
class Alias(MyBaseModel):
remote_image = models.URLField(max_length=500, null=True, help_text="A URL that is downloaded and cached for the image. Only
used when the alias is made")
image = models.ImageField(upload_to='alias', default='alias-default.png', help_text="An image representing the alias")
def save(self, *args, **kw):
if (not self.image or self.image.name == 'alias-default.png') and self.remote_image :
try :
data = utils.fetch(self.remote_image)
image = StringIO.StringIO(data)
image = Image.open(image)
buf = StringIO.StringIO()
image.save(buf, format='PNG')
self.image.save(hashlib.md5(self.string_id).hexdigest() + ".png", ContentFile(buf.getvalue()))
except IOError :
pass
Run Code Online (Sandbox Code Playgroud)
这首次remote_image变化很有效.
当有人修改remote_image了别名时,如何获取新图像?其次,是否有更好的方法来缓存远程图像?
???????????????????????????????????????????????? ^
? ImageView ???????????????? ? |
? ? ? ? |
? ? Actual image ? ? |
? ? ? ? |60px height of ImageView
? ? ? ? |
? ? ? ? |
? ???????????????? ? |
????????????????????????????????????????????????
<------------------------------------------------>
90px width of ImageView
Run Code Online (Sandbox Code Playgroud)
我有一个默认高度和宽度的图像视图,图像存储在数据库中,我想根据Imageview高度宽度缩放图像.因为我不希望它给出默认值,因为当我改变它的高度和宽度时我也必须在代码中更改它.
我试图获得ImageView的高度和宽度,但在两种情况下都返回0.
int height = ((ImageView) v.findViewById(R.id.img_ItemView)).getHeight();
Run Code Online (Sandbox Code Playgroud)
即使它有默认的高度和宽度,这也会返回0
如Size,Width和Height是Get()的性质System.Drawing.Image;
如何在C#中运行时调整Image对象的大小?
现在,我只是创建一个新的Image使用:
// objImage is the original Image
Bitmap objBitmap = new Bitmap(objImage, new Size(227, 171));
Run Code Online (Sandbox Code Playgroud) 我正试图在我的应用程序内打开Gallery内置应用程序中的图像/图片.
我有一张图片的URI(图片位于SD卡上).
你有什么建议吗?
我想编写一个模块,只需单击按钮,相机就会打开,我可以单击并捕获图像.如果我不喜欢图像,我可以删除它并再单击一个图像,然后选择图像,它应该返回并在活动中显示该图像.