How to display GIF in app? - swift

i am trying to load gif in my project as per my requirement to show animation,
i have used third-party lib for showing gif animation,
i have copied same code from demo project but not working in my project.
Here is my code :
let animatedGif = UIImage.gif(name: "loading")

As #Patrick suggested, you have to replace your image path from asset folder and move it in your app’s bundle. This issue is also raised in its official git library’s issue tab. https://github.com/bahlo/SwiftGif/issues/67.

Related

How to upload demo image in my android github project

I have uploaded my project to github account successfully but i am
able to add a demo image or gif to it.
You just need to follow the suggestion at the bottom of your screenshot: Add a README
There you can embed images, both still or moving
Click Add a README on your screen, or manually submit a file called README.md in the page that you want an image to be on (You can have a different README.md file on every folder)
In that file add a link to an image using this tag:
![screen shot](http://i.imgur.com/example.png)

images in GitHub are not working on Readme

I recently tried to add some screenshots on my repository readme using the mark up
![](url for the picture)
and I couldn't get it the screenshot to show, I am very new to GitHub, I watched a couple videos but I can't find out why this is happening.
Thanks a lot!
You could check out a repository and see how they did it.
For example check the repo Material Dashboard .
Now in the code section press the README.md file and open a raw view, ie. README.md raw.
You can see that they add png/images like so:
[![Start page](assets/github/dashboard.png)]
Note that you'll have to add a folder named assets and upload (or push) the images you want to show.

Big gif from a third party site does not show in the README.md of github?

I want to show a gif in a README.md of github.
And it works fine when the target gif is small with:
<img src="targetGifUrl" width="400">
but when the gif is big, it is not showing as expected, take this gif as an example. When I add it into README.md, it just shows:
and after clicking, it shows a website with the tip
Content length exceeded
As the gif is from a third site, I can not change its size.
So, is it possible to show this big gif without saving and resizing it?
It looks like someone else had this issue before,
When I open this link in Firefox, I only get the text "Content length exceeded".
and here is the commit that fixed it.
Add gif locally
-![Sample Gif](http://i.imgur.com/______.gif)
+<img src="/art/sample.gif?raw=true" width="200px">
Looks like all you have to do is save the gif and put it in your repository, no need to resize it, just link to the version in your repository. Notice how the width is specified and raw=true is an included parameter.
Put Gif files in the local directory on your git repo. Then call it in readme file.
For example, If you just created a folder called demo in the root directory and put demo.gif inside it. Then you can call that in your readme file like this.
![Demo File](https://github.com/username/repo-name/blob/master/demo/demo.gif)
Eg:
![Screenshot](https://github.com/codemaker2015/React-native-map-view/blob/master/demo/demo.gif)

JavaFX 2.2 generated image not shown after building jar-file

In my JavaFX Application I generate a barcode with barcode4j by Apache, save it as png image in the directory /data/images/ and embed it in a web page which is shown on a JavaFX WebView.
After generating the barcode I embend it into the webpage using the following Javascript-Code:
path = "file:/" + path.replace(/\\/gi,"/");
var barcodeElement = document.getElementById("productBarcode");
barcodeElement.setAttribute("src", path );
barcodeElement.style.display = "inline-block";
I use the absolute path C:\path\to\java-program\data\myimage.png and build a file-URL from it.
Using this in Eclipse works without any problems. But when I build my project and start it from my jar-file the image is not shown. But the problem is not, that the path is incorrect or that generating the picture does not work, so that there is some kind of "not found" error. The place where the image should be is just white with a light border around.
And now the strangest part: If you right click on the image and choose "open in new window" the image is shown!
Does someone has an idea about that?
Thank you very much in advance!
My understanding is that the WebView won't let a page loaded with one protocol access files using another one. This makes perfect sense when you load through http://, and forbid file://. Here, you're loading through jar:file:..., and the webview will only let you access jar:file:... resources (I just tried, I can access an image from another jar file, from the same jar file, but not from outside!).
This sounds very much like a bug to me.
One workaround mentioned here is to use "data:" URI (i.e. encode the image directly in the HTML file).

How to render all kinds of SVG files on iPhone?

For rendering svg file on iPhone I have downloaded a project from GitHub
SVGQuartzRenderer
but it shows the following errors:
UIKit/UIKit.h No such file or directory
(I am not able to add it using add existing frameworks)
Libxml/tree.h:No such file or directory
Expected specifier-qualifier list before xmlParserCtxtPtr
Does anyone know how I can make this project work?
I have also found another framework:
SVGKit.
It works well for some SVG files but not for all.
Is it possible to render any SVG file in iPhone without using UIWebView and are there any tutorials or sample code?
Starting Xcode 12, you can add the .svg file in your Assets Catalog and do this:
let image = UIImage(named: "SomeSVGImage")
ref: https://developer.apple.com/documentation/xcode-release-notes/xcode-12-beta-release-notes