Angular Firebase scroll issue in chrome due to images - html

Angular 6: Images takes time to load in chrome
This issue is specifically in chrome and not in any other browser.
We have used Firebase in our project, and used snapshotchange method to fetch the image to angular project from the same, the image urls are like this https://firebasestorage.googleapis.com/v0/b/test-4a5d9.appspot.com/o/download.jpg?alt=media&token=a78321fc-eb9c-496a-a690-e8b2ccddf6c6 . There is something wrong due to which, image loads very slowly and the screen becomes blank when we scroll up and down in the browser, here we have used "ngx-infinite-scroll".
I have also tried by concatenating .jpg extension after the image but the scenario remains the same.
First, I thought the problem is with the size of image which is affecting the loading speed, so then I have replaced the images with https://upload.wikimedia.org/wikipedia/commons/b/b9/Pizigani_1367_Chart_1MB.jpg which is a heavy size of image, but here the website run's smoothly without any issue.
But it does not scroll smoothly when image urls are like this https://firebasestorage.googleapis.com/v0/b/test-4a5d9.appspot.com/o/download.jpg?alt=media&token=a78321fc-eb9c-496a-a690-e8b2ccddf6c6
Here is the code to set images in one list item:
<div class="slider">
<div class="slideshow-container" id="{{works.id}}_" *ngIf="works.media">
<div class="imgSlides imgsss active" *ngIf="works.media.aFront != undefined">
<div class="content">
<div>
<img src="{{works.media.aFront}}" alt="front img" />
</div>
</div>
</div>
<div class="imgSlides imgsss" *ngIf="works.media.bBack != undefined">
<div class="content">
<div>
<img src="{{works.media.bBack}}" alt="back img" />
</div>
</div>
</div>
<div class="imgSlides imgsss" *ngIf="works.media.cLeft != undefined">
<div class="content">
<div>
<img src="{{works.media.cLeft}}" alt="left img" />
</div>
</div>
</div>
<div class="imgSlides imgsss" *ngIf="works.media.dRight != undefined">
<div class="content">
<div>
<img src="{{works.media.dRight}}" alt="right img" />
</div>
</div>
</div>
<div class="imgSlides imgsss" *ngIf="works.media.ePanoroma != undefined">
<div class="content">
<div>
<img src="{{works.media.ePanoroma}}" alt="panoroma img" />
</div>
</div>
</div>
<div class="imgSlides imgsss" *ngIf="works.media.fDetail != undefined">
<div class="content">
<div>
<img src="{{works.media.fDetail}}" alt="detail img" />
</div>
</div>
</div>
<!-- arrow -->
<div *ngIf="works.imageCount>1">
<a class="next arrow-control" (click)="plusSlide(1,works.id + '_')"> <img src="assets/image/backward.png" alt="previous arrow" /> </a>
<a class="prev arrow-control" (click)="plusSlide(-1,works.id + '_')"> <img src="assets/image/forward.png" alt="next arrow" /> </a>
</div>
<p class="sold-btn" *ngIf="works.isSold">{{'Sold'}}</p>
</div>
<div class="slideshow-container" *ngIf="isEmptyObject(works.media)">
<div class="content">
<div [ngStyle]="{'background-image': 'url(' + defaultimg + ')'}" class="img-thumb"></div>
</div>
</div>
<div style="text-align:center;display:none;" class="bullets">
</div>
</div>
Here is the video of the problem:
https://drive.google.com/file/d/1Ipl-34rOE2ZcscF3jrPYw2C9WfgnA29U/view?usp=sharing

Do the images need to be private?
You don't have any caching enabled on your images.
If you check the headers for the image they have Cache-Control: private.
Since the browser isn't allowed to cache the images, it might affect the performance quite a bit.
Potential fix
I would suggest allowing the user to cache the images for at least an hour.
You will need to set the correct cache headers when uploading the images.
But you can easily via googles gsutil set the headers for all files in a folder
This is what I use:
Where in this case we cache the images for 1year and make them immutable causing the browser to always use the cached version
gsutil -m setmeta -h "Cache-Control:public,max-age=31536000,immutable" 'gs://my-storage-bucket-name/myimagefolder/**/*.{jpg,png}'
Hopefully this could make the app more performant, but you will have to try to know.

Related

Image and the text is being displayed consecutively

I have tried to copy my section in the webpage as it is but when I copied my HTML5 code one below the previous it gave me an error, Such that the image in the first is at left and the text to right and I want it reverse for second section.
<div id="showcase-container">
<div class="showcase1">
<div class="col-2">
<img class="showcase1pic" src="images/apple.jpeg">
</div>
<div class="col-2">
<div class="feature-text">
<h1 class="section-title">Yes, it even looks good on an iPhone</h1>
<p class="section-left">It is important to make sure that you are coding for responsive design.We want all of our work to function property on all devices. This is the awesome way</p>
</div>
</div> <!-- End of Feature Text -->
</div>
</div>
<div id="showcase-container">
<div class="showcase1">
<div class="col-2">
<img class="showcase1pic" src="images/apple.jpeg">
</div>
<div class="col-2">
<div class="feature-text">
<h1 class="section-title">Yes, it even looks good on an iPhone</h1>
<p class="section-left">It is important to make sure that you are coding for responsive design.We want all of our work to function property on all devices. This is the awesome way</p>
</div>
</div> <!-- End of Feature Text -->
</div>
</div>
This is the image i want to display consecutively below it
This is the output I am getting

Trouble Displaying Images in AWS S3: 404 Error Not Found

I coded up my website with html and css in Dreamweaver. When I open the html documents locally on my computer, the images all load (everywhere, including on the Art/Design page). When I uploaded all of the files to AWS, only three out of the sixteen gallery images loaded (the 7th, 8th, and 9th). For each of the gallery divs, including the images in them, the code is identical. When opened in chrome, developer tools show the images which didn't load cannot be found (404 error). The images do not load through the direct url or my domain. Other images outside of the gallery loaded fine.
Here is the html:
<section id="full-width">
<div class="title2">
<p>Fine Art</p>
</div>
<section id="pictures">
<div class="column">
<div class="gallery">
<img src="Images/Gallery/1.jpg" alt="" class="gallery-image">
<div class="title4">
<h>Study of the Eye</h>
<h1>2016</h1>
<p>Graphite on paper.</p>
</div>
</div>
<div class="gallery">
<img src="Images/Gallery/2.jpg" alt="" class="gallery-image">
<div class="title4">
<h>Study of the Iris</h>
<h1>2016</h1>
<p>Hard pastel on paper</p>
</div>
</div>
... <!--skipping a few elements-->
<!-- The following three images load without fail-->
<img src="Images/Gallery/9.jpg" alt="" class="gallery-image">
<div class="title4">
<h>Fahrenheit 451 Alternate Cover</h>
<h1>2013</h1>
<p>Spray paint on newspaper on canvas</p>
</div>
</div>
</div>
<div class="column">
<div class="gallery">
<img src="Images/Gallery/12.jpg" alt="" class="gallery-image">
<div class="title4">
<h>Glint</h>
<h1>2015</h1>
<p>Acrylic on illustration board</p>
</div>
</div>
<div class="gallery">
<img src="Images/Gallery/10.jpg" alt="" class="gallery-image">
<div class="title4">
<h>Impressionist Self-Portrait</h>
<h1>2015</h1>
<p>Soft-pastel on illustration board.</p>
</div>
</div>
<!-- the following, again, do not load -->
<div class="gallery">
<img src="Images/Gallery/8.jpg" alt="" class="gallery-image">
<div class="title4">
<h>Self-Portrait: Creation</h>
<h1>2016</h1>
<p>Graphite on paper</p>
</div>
</div>
... <!-- skipping more elements -->
</div>
</div>
</div>
I don't understand how some images can load and others cannot. The images which load are not the smallest sized images of the group, and neither is there anything which sets them apart.
Bonus question: why can't my error.html page load the stylesheets? (Again, Chrome claims 404 error, cannot be found)?

HTML included side menu interferes with page spacing

I'm trying to build a page with a lightbox gallery and an included menu down the side. When the menu is included it creates a large space between the gallery rows that I can't remove which goes away when the menu is removed.
<tr>
<td rowspan="10" id="body-text-other">
<span style="float:left;"><?php include("includes/header-store.html") ?></span>
<span style="width: 100px;"><?php include("includes_releasing/store_menu.html") ?></span>
<div>
<p id="body-text-lrg">Pledge Cards</p>
<div class="imageRow">
<div class="single">
<img src="images/art/gallery/Arise-thumbnail.png" alt="" />
</div>
<div class="single">
<img src="images/art/gallery/Reluctance-thumbnail.png" alt="" />
</div>
</div>
<div class="imageRow">
<div class="single">
<img src="images/art/gallery/Correlation-thumbnail.png" alt="" />
</div>
<div class="single">
<img src="images/art/gallery/Dissidence-thumbnail.png" alt="" />
</div>
</div>
Thanks
Welcome to SO. If you could provide more sample code we can take a better look at it. The problem may be that you are using tables and the default padding/margin are making it bigger.
If you could provide a JSFiddle we can help more.
Thanks and goodluck.
http://jsfiddle.net/

Bootstrap Media Object not loading image

I'm trying to load the bootstrap media object inside a span3 div.
Everything works, apart from the image. I've checked this link elsewhere and it has no issues.
Any suggestions
<div class="container">
<div class="row">
<div class="span3">
<div class="pull-left">
<h3>Top Devices</h3>
<div class="media">
<a class="pull-left" href="#">
<img class="media-object" data-src="<?php echo base_url(); ?>resource/img/devices/Asus-Nexus-7.png"/>
</a>
<div class="media-body">
<h4 class="media-heading">Media heading</h4>
</div>
</div>
</div>
</div>
If it's just a regular image you are loading into the span3, is there a reason why you are using data-src and not src ?
Or if you are also using something like foresight.js, for example, see if this post helps you
Good luck!
Check the source code out, probably it will gives you the answer.
I think you should add an slash:
data-src="/resource/img/devices/Asus-Nexus-7.png
instead of:
data-src="resource/img/devices/Asus-Nexus-7.png
Grretings

Why the images in the <img> arent showing up in the webpage?

I have the following HTML code, but when I try to view the page the images aren't showing, can tell me why this is? The image paths are correct.
<div class="content container_16">
<div id="sidebar" class="grid_4 alpha">
<div class="widget cats">
<div class="w-title"><?php echo $lbl_categories; ?></div>
<ul>
<?php wp_list_cats("sort_order=name&exclude=1&hide_empty=0"); ?>
</ul>
</div>
</div>
<div id="main-body" class="grid_12 omega">
<div id="ad-top" class="grid_12">
<img src="<?php bloginfo("template_url"); ?>/images/content-top.png" alt="Some text"/>
<img src="<?php bloginfo("template_url"); ?>/images/logo.png" alt="Logo">
</div>
<div>
<p>some text follows here</p>
</div>
</div>
While in Firebug the total div (ad-top) looks like dimmed.
Small update: When I remove the id from the div, its showing back - strange.
If you are using LINUX, make sure that you have read/write access to the images folder.
Also ensure that your images URL are correct.