I want to use image cache in my ionic app, I found ionic-cache-src in google, but after I try use that, that's not working, just show blank rectangle.
here is my code :
<img cache-src={{values.service_parkingsite_imagefilepath}} alt="" style="height:80px; width:100px;">
note : values.service_parkingsite_imagefilepath is https url.
I have also follow all instalation step in https://libraries.io/bower/ionic-cache-src, anybody can help ?
You may replace image with div by setting src-is to background.
Related
I am looking for solution to display image from a url. I am hard coding the url in my source code but want to keep changing the image associated with the url.
is it possible guys?
thank you
Yes, it is possible. The easiest way is to add a query string after url. It also works for both iOS and android:
<Image
style={styles.yourImageStyle}
source={uri: this.state.yourPhotoURL + '?' + new Date()}
/>
I hope it helps you :)
I have a problem in ionic2 , my image doesn't show up in my android phone
its run normally in localhost...
{{item.name}} = A+
And my image =/assets/image/A+.png
<ion-avatar item-left>
<img src="../assets/image/{{item.name}}.png">
</ion-avatar>
I have used Ionic 2 a lot for iOS but not Android. For my apps I would set the src to be:
<img src="assets/image/{{item.name}}.png">
Rather than
<img src="../assets/image/{{item.name}}.png">
Take a look at this forum post
Seems like a device is accessing assets through /android_assets/www/<your path relative to index.html>
You need to add [] to your src attribute otherwise your img tag is being read in the html at this exactly.
<img src="assets/image/{{item.name}}.png">
and obviously your file name is not {{item.name}}.png . It should be
<img [src]="assets/image/{{item.name}}.png">
to allow dynamic content.
I also think it is ../assets/image as your build folder sits on the same level as your assets folder
I put same image under these folders and it worked for me:
1) www/assets/img/
2) src/assests/img/
then in HTML code:
<img src="assets/img/image.png">
Im Trying show an image from web (external) with handlebar template
in my arq.handlebars I have this:
< img src="http://127.0.0.1:3000/system/products/avatars/034/thumb/image.jpg" data-rel="external"/ >
I also tried so:
< a class="imagem" style="background-image: url(http://127.0.0.1:3000/system/products/avatars/034/thumb/image.jpg);" data-rel="external" />
But it is not working. what appears is me: [?] (an icon like this)
Where did this path come from? Unless you're running something on your phone on Port 3000 this isn't going to work. The correct path in Cordova file:///android_asset/www/ assuming that you put your code in the assets/www directory of your project.
Either that or find out where the actual image is coming from and replace the path with the address of that server.
In my little app i have a webview, i only have one html file in the assets folder. I'm trying to use a named anchor to make a Jump Link but it doesn't work. It only says Web page not available I don't know where i'm wrong. Is it trying to load a html file with the name tag i provided?
WebView mWebView = (WebView) findViewById(R.id.mywebview);
mWebView.loadUrl("file:///android_asset/topics.html");
EDIT:
here's my html
<html>
<body>
<a href=”#tip”>Go somewhere</a>
//a lot of <br/>...
Somewhere
<a name=”tip”></a>
</body>
</html>
And yes the topics.html is under assets/
Where does your program fail - with the loading or when you click the anchor? It sounds like the problem is with your HTML file, so you should probably show the code from that instead. :) Also, the full LogCat output is handy too. The more info the merrier.
I recently implemented a WebView, the HTML code is extremely straight-forward (since I know close to no HTML and just wanted an easy way to display documentation). A simple anchor is just this for example:
Navigating the application
...
<a name="q1"></a>
<p><b>Navigating the application</b></p>
<p>...sliding motion (to the left or to the right) with your finger...</p>
If your program is failing at the actual loading part, then ensure that you have placed the topics.html file correctly in the /assets/ folder in your project folder. It has to be at the very root of your project folder - ie. workspace\<projectname>\assets\topics.html
Your code for loading the webpage looks fine.
Hey guys, new to HTML, can't find a simple solution anywhere.
I am writing an app for android that "streams" video by taking photos at a small set interval. The idea is to stream this to a website, my problem is that I can't find a simple, small way to refresh just the image on the website (yes, I'm coding the website too).
Any pointers would be great, I'm not looking for a complete worked solution, just some ideas.
You can change the src attribute of the current image to the new image using javascript
var image = new Image();
image.src = "newimagedir.jpg";
image.onload = function(){
//when it loads
document.getElementById("myImage").src= image.src;
}
<img src="" id="myImage" />
If you are going to be doing a lot of HTML manipulation i suggest you use a javascript library. If so you can see how to change the image here: Changing the image source using jQuery