Including a gif in html page - html

I have no idea why a simple gif image is not being loaded properly. In the html code I have the usual
<img src="/img/loading.gif" alt="Loading" title="Loading" />
and the file is in that folder. The weird thing is that if I place there /img/logo.png the image is loaded properly.
The filename is correct, I've even copied and pasted it renaming the original files.
PS tested on Firefox 12, Safari 6.0.2 Chrome 23.0.1271.95 (all for Mac)

It was probably a corrupt gif. Your code should work with some other gif. If you really want to get the corrupt gif to work, try opening it in an image editor program and then resave it as gif (or any other format).

Silly question, but what does your gif look like? Is it transparent, or white against a white background?
One possible way to diagnose the problem would be (in Chrome or Firefox), to press F12 to bring up the developer tools and look at your img element to see if the image has loaded in the DOM.

I think the problem was with the gif file, probably somehow broken. I got it from a random resources web site and downloaded from it.
I've tried with a new file got from http://www.ajaxload.info/ now with the code unchanged it works fine.
Edit: the "broken" gif file was working fine elsewhere in the system (e.g. quicklook).

Related

Images being found on website load but not loaded correctly (broken)

Have this weird case when my images are being found in sources, linked correctly, src url is okay, but still not being displayed. Other images in that same folder are being loaded and displayed just fine, but my new uploaded images are not. I'm using open cart and upload images via ftp. Permissions are fine 644 like the others. I asked other developers in my team and no one has any clue why is that. Guys tried downlaoding and opening the image on their computer and can't even open it, whereas I'm using MAC and can open the same images on my computer without any problems. Images are saved as .jpg from Photoshop. What's the deal here? Here is how it looks in Mozilla:
This can happen because of corrupted image file. Most likely it is the extension problem of the file. Instead of doing save as in Photoshop, try exporting the image through export settings and choose png or jpg format there. It should work fine now, it worked for me.
Just to make sure on this front - Are you uploading them as .JPG or .jpg? If so, the problem may lie there...
If you link to a file that is .jpg and you put .JPG into the code for the link, the link will not work.
Make sure you're not using uppercase JPG as some servers will not read/detect them, and you will not able to see the pictures until you change the extension to lower case jpg.
Also, make sure the color mode, if saving them from Photoshop directly to jpg, is RGB format. If you use any other color mode, it may not display at all. CMYK files for example will not display correctly.

img not visible .. but it is there

something confusing.. I have a img-tag
<img src="http://example.com/images/1452630193_9305-normal.jpg" class="fqfqpowzxfpdkrchufzi">
But the image is not visible in the browser (FF 48.0.2).. the inspector says "could not load file".. but when I copy the path and paste it in the url of the browser, the image is definetly there.
also on my older version of FF, the image shows up correctly.
did I miss something important? why is the image not showing up?
Since all of the images are located in the "ad_min" directory, I think you have an adblocker that has picked up the "ad" in the URL and blocked the image from loading.
My chrome dev tools has said that the image has been blocked from loading by the client, which is why I am suspicious.
I disabled my adblock, and surely enough, the images did load like they were meant to

Did I just create a real animated .JPG file?

It all started with this GIF image I found online: https://media.giphy.com/media/9fbYYzdf6BbQA/giphy.gif
I downloaded it to my computer, which runs Windows 10, put it on my desktop, and edited the file name to change ".gif" to ".jpg." The conversion ended up working fine, and I opened the image saved to my computer in my internet browser, Opera, just to see if it would still animate. It opened a file:// URL, and it showed the jpg normally, animating like a GIF would. So, I decided to see if other people saw the JPG animating like a gif, and on a forum site I am an admin for, I uploaded the image as an attachment to a thread. I made the thread, this was the image file I now had, basically just a normal JPG but animated: s4224.storage.proboards.com/5644224/t/crq4LpxP3rTT6eTORg1o.jpg
When I opened the image in Firefox, and got info on the image, Firefox still thought it was a gif in one area showing the file type, though. Internet Explorer said nothing about it being a GIF when I opened the image in that browser. I then saved the page as a JPG, uploaded it to vgy.me, and still got a .JPG result: vgy.me/dX1KGD.jpg
So, have I created a normal, animated .JPG image? Or is it still just a .GIF file that tricks internet browsers? I remember while I was inspecting the image in Opera that it showed the file/image type as "image/jpeg" as well. Seems to be keeping that metadata!
If you serve a file with a .jpg extension, web servers will normally serve that with a media type of image/jpeg, hence that what will get reported in the browser.
But in practice, image files have very different formats, and it's easy for browsers to inspect the file data itself to decide whether it's a JPG or GIF file and process it accordingly. The process that browsers use for doing this is defined in the MIME Sniffing Standard, which includes the MIME sniffing in an image context algorithm.
So, as Xufox says in their comment, it's still a GIF file regardless of its extension.
https://answers.microsoft.com/en-us/windows/forum/apps_windows_10-photos-winpc/living-images-in-windows-10-photo-app/15736942-9fa7-48eb-bfd4-2152acb582ce
"If you copy the file to a computer and then change the extension to .zip, and open the zip file, you will be able to see the separate jpeg and MP4 files inside. This is what you were asking I assume?"

Webpage stuck in loading in Chrome

My webpage gets stuck in loading in Chrome (the little spinning icon on the page tab, and the mouse cursor also stuck in loading version), but the odd thing is everything in the website displays fine. This doesn't happen in Firefox or IE.
Does anyone have any theory to what's causing it? Is it because some asset doesn't exist? For example:
<img src="pic.png">
But "pic.png" doesn't exist?
If that's the case how do I check the code to make sure all assets, including css/js/img/sound/video files all exist as linked from the document? My html file is huge, going line by line and checking would take forever.

Images not displaying in WebKit based browsers

For some strange, bizarre reason, my images in my website just will not display on webkit based languages (such as safari and chrome).
This is the image tag
<img src="images/dukkah.jpg" class="imgleft"/>
Not only does it not display in the website, it wont display when accessed directly at http://kilkin.massiveatom.com/kilkin/images/dukkah.jpg
...Why?
Imagemagick reports that this particular image is saved in CMYK colorspace instead of the more standard RGB. Try converting it, it should be more compatible with the webkit rendering engine.
Imagemagick is available for download from http://www.imagemagick.org/script/index.php - it's available for windows and *NIX systems.
I have come across this problem a couple of times.
I think it is because of some problem in the file format.
Try importing the file in some image editor and saving it again. This should get rid of the problem.
I tried the url you gave in FireFox 3 and IE 6, IE 6 won't show it either, firefox works. My guess is that there is something wrong with the jpg file.
Are you JPEG's compressed in Jpeg 2000 Format? If so, there is a known bug:
https://bugs.webkit.org/show_bug.cgi?id=8754
"The image “http://kilkin.massiveatom.com/kilkin/images/dukkah.jpg” cannot be displayed, because it contains errors." and the image itself has some XML-fragment in it. So as others proposed: try to open with an editor and resave it.
It's as stated elsewere a bug in the image.
Irfanview is a very good viewer that will display any image (and other formats as well), is small and free and will also let you adjust, crop or rescale images very easily without heavy programs like photoshop.
I suggest download irfanview and the image, open the image in irfanview and hit CTRL+S and save it over itself. Then upload the image again. Any problem should be solved.
Your image file does not contain image data, it contains html text:
$ curl -s http://kilkin.massiveatom.com/kilkin/images/dukkah.jpg
<html><head></head><body><!-- vbe --></body></html>