我正在使用div其中包含任意数量img元素的内容.现在,每个img都有以下CSS:
#content > img {
display: none;
position: absolute;
top: 0px;
left: 0px;
}
Run Code Online (Sandbox Code Playgroud)
并且图像可以循环显示,并具有依次显示和隐藏它们的功能.但是,在加载每个图像时,我想显示"加载..."图像.我想使用JavaScript/jQuery将每个不完整图像的源交换为"loading ..."图像,同时仍然允许它加载.什么是精益和卑鄙的方式来做到这一点?
您是Web技术概念的新手,我有两个问题.
Q.1)假设我有400KB大小的图像,我想在我的网页上加载它.我想知道以下哪一步更快
a)一次加载整个400KB图像.
b)具有上述图像的4个图块(每个100 KB)并逐个加载它们.
Q.2)如果要在网页上加载4张图像,是否可以按一定时间间隔请求每张图像或立即请求它们.
如果问题很愚蠢,请耐心等待.
我查看毕加索的文档,看不到有关线程的任何信息.如果我运行这样的东西会发生什么(for ListView):
for(String url : urlArray)
{
Picasso.with(context).load(url).into(Holder.imageView);
}
Run Code Online (Sandbox Code Playgroud)
图像是平行加载还是逐个加载?
我有一个ListView与项目中的一些内容(TextViews,ImageView ...).我正在使用Nostra的UIL加载项目中的图像,但其中一些无法加载.当我打电话时,这就是我得到的Log.v(String.valueOf(failReason.getCause());:
11-16 23:52:20.447: V/javax.net.ssl.SSLHandshakeException: Handshake failed(17467): failz
11-16 23:52:20.657: V/NativeCrypto(17467): SSL handshake aborted: ssl=0x15fd758: Failure in SSL library, usually a protocol error
11-16 23:52:20.657: V/NativeCrypto(17467): error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure (external/openssl/ssl/s23_clnt.c:762 0x4c2ed485:0x00000000)
11-16 23:52:21.207: V/NativeCrypto(17467): SSL handshake aborted: ssl=0x1562468: Failure in SSL library, usually a protocol error
11-16 23:52:21.207: V/NativeCrypto(17467): error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure (external/openssl/ssl/s23_clnt.c:762 0x4c2ed485:0x00000000)
Run Code Online (Sandbox Code Playgroud)
你不知道,为什么会出现这个问题或者我该如何解决?
这是一个示例图像,无法加载:
http://bigparty.cz/photos/headlinefoto/13.jpg
(我可以附加一个包含整个错误的日志 - UIL 自动将其放入Log的错误)
android image-loading imageview sslhandshakeexception universal-image-loader
我正在试验并行和 LINQ。看看下面的代码。它有效,但只是为了得到这个想法:
private void LoadImages(string path)
{
images =
Directory.GetFiles(path)
.Select(f => GetImage(f))
.ToList();
}
private Image GetImage(string path)
{
return Image.FromFile(path);
}
Run Code Online (Sandbox Code Playgroud)
所以我基本上是从指定目录中找到的每个文件中获取图像。问题是 - 如何使这种平行?现在就像迭代它们一样。我想“以某种方式”并行化它。不知何故,因为我太缺乏经验,无法提出如何实现这一目标的想法,所以这就是为什么我问你们,伙计们,依靠一些帮助来加快速度:)
我正在寻找一种我可以使用的设计模式,以便在android recyclerView中我可以快速加载低质量的图像,然后调用高质量的图像,之后将覆盖低质量的图像。我经常看到先加载低质量图像,然后加载高质量图像的情况。
但是如何在适配器中实现回收者视图。现在我正在使用毕加索进行缓存和图像加载。因此,例如,这里是指向低质量图像的链接:
http://example.com/lowQuality.jpg以及高质量的http://example.com/highQuality.jpg
所以在我的recyclerView适配器中,如果我在viewholder中这样做:
public class SearchItemHolder extends RecyclerView.ViewHolder {
@BindView(R.id.iv)
ImageView iv;
@BindView(R.id.tv_description)
TextView tv_description;
public SearchItemHolder(View view) {
super(view);
ButterKnife.bind(this, view);
}
public void bindSearch(final SearchModel searchModel) {
String description = searchModel.getProductName();
final String imageLowQualityIDUrl = searchModel.getIdLowQualityImage();
final String imageHighQualityIDUrl = searchModel.getIdHighQualityImage();
tv_price.setText(price);
tv_description.setText(description);
Picasso.with(mContext).load(imageLowQualityIDUrl).into(iv);
//but how to switch it to high quality URL after its finished loading ?
}
}
Run Code Online (Sandbox Code Playgroud)
因此,要明确一点,只要高质量图像尚未加载,我希望低质量图像可以首先显示。
更新:我真正想要的是我在低质量图像快速加载的应用程序上看到的效果,然后在几秒钟后过渡到更高质量。如果还有其他工具或方法可以让我知道。我想要与whatsapp个人资料图片相同的效果(它如何从劣质逐渐淡化为高质量)。
image progressive-download image-loading android-recyclerview
我有许多"联系"对象,每个对象都有一个与之关联的imageURL字符串.我所看到的将图像放入ListView的所有方法都涉及手动将图像放入"可绘制"文件夹并调用资源.手动输入图像会破坏这个目的.我提供了我的getView方法,注释掉的行是我很困惑的.
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View row = inflater.inflate(R.layout.single_row, parent, false);
TextView name = (TextView) row.findViewById(R.id.topLine);
TextView phone = (TextView) row.findViewById(R.id.secondLine);
ImageView icon = (ImageView) row.findViewById(R.id.icon);
name.setText(contactArray.get(position).getName());
phone.setText((CharSequence) contactArray.get(position).getPhone().getWorkPhone());
//icon.setImage from contactArray.get(position).getImageURL(); ????
return row;
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试读取 JPEG 文件,但是当我尝试这样做时:
InputStream input = new URL("http://s4.postimg.org/h1c72546l/invalid_icc_profile.jpg").openStream();
try {
ImageIO.read(input);
System.out.println("Image loaded.");
} catch (Throwable e) {
e.printStackTrace();
} finally {
input.close();
}
Run Code Online (Sandbox Code Playgroud)
我收到以下异常:
javax.imageio.IIOException: Invalid icc profile: duplicate sequence numbers
at com.sun.imageio.plugins.jpeg.JPEGImageReader.readImageHeader(Native Method)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.readNativeHeader(JPEGImageReader.java:604)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.checkTablesOnly(JPEGImageReader.java:342)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.gotoImage(JPEGImageReader.java:476)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.readHeader(JPEGImageReader.java:597)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:1054)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEGImageReader.java:1034)
at javax.imageio.ImageIO.read(ImageIO.java:1448)
at javax.imageio.ImageIO.read(ImageIO.java:1352)
Run Code Online (Sandbox Code Playgroud)
仅此图像出现此异常:http://s4.postimg.org/h1c72546l/invalid_icc_profile.jpg
我测试了JDK 7和8,都有错误。您对如何阅读图像有什么建议吗?可以调整icc配置文件吗?
我只是从Glide迁移我的Android应用程序.但是在尝试播放GIF图像时我遇到了问题.是否可以使用Picasso播放GIF图像?谢谢.
我使用以下代码使用Glide从服务器加载图像:
private void loadImage(Context context, String url, ImageView imageView, int x1, int y1, int x2, int y2) {
Glide.with(context)
.load(url)
.into(imageView);
}
Run Code Online (Sandbox Code Playgroud)
我需要在ImageView中只显示一段图像.这件作品的坐标放在变量x1,x2,y1和y2中.如何使用Glide仅剪切所需的图像部分?
image-loading ×10
android ×5
imageview ×2
java ×2
javascript ×2
picasso ×2
asynchronous ×1
c# ×1
html ×1
image ×1
jpeg ×1
jquery ×1
linq ×1
performance ×1
webpage ×1