Yes, in Coothead’s reply, he used “poster.png” as the thumbnail.
In real life, my newly down-sized thumbnails run about 80KB in size.
In this code mockup, I had asked Coothead how to make his idea work for video as well - this the name of the ZIP.
So most of the time, when you click on a thumbnail, that < div > loads an enlarged photo that is around 500KB in size and has a long-side of 800px.
In this example, when you click on the thumbnail, it loads a video instead. So for this code, you’ll see a “test-video.mp4” in the “video” folder.
(The problem that i was having with videos is that they were spilling outside the screen, so with change one line to height: 90vh the video started fitting in the pop-up modal. Other than that, the logic is entirely the same for photos or videos. HTH.)
That wouldn’t help.
To be clear… With pure photo situations, I have one physical file that is a thumbnail (i.e. 80KB) and then another physical file that is a detailed-photo (i.e. 500KB).
When the gallery loads, clearly you see all thumbnails. HOWEVER, who is to say that the larger image isn’t getting loaded in the background because my CSS is not behaving as expected?
I follow you. How do you know those thumbnails you’re seeing are not just reduced versions of the larger image? I gave you a way to find that out. How do you determine if your larger image has been loaded on the page somewhere? I gave you a way to find that out. Without being able to look at your page myself, all I can give you is the way to do it yourself.
I think the problem is that my detailed-photos are getting loaded in the background when they are not supposed to be!
I went into my “photo-gallery.php” file and commented out the code that loads the modal window and detailed-photo, and while still somewhat slow, the page load time is cut down substantially!
Okay, I tried this just now on my live site, and hit “refresh” and this time under the “Network” tab I am seeing the images in addition to the stylesheet.
From the above script snippet I would have guessed that the images/poster.png would load followed by video/test-video.mp4.
After the previous two files have loaded then the picture thumbnails would load? I would be tempted to try and load the picture thumbnails before the audio file.
I don’t have an easy answer for you, but as far as I can tell the problem lies here:
.flexGallery li div{
display: none;
}
in your CSS. display:none does not guarantee that the browser won’t still download the file, it just tells the browser not to actually display it. But this code is using that one line to cause the image to not display until someone clicks on the li, at which point it changes it to display:block and it appears. That all is presumably working, but this issue of all the large images being downloaded anyway, is just not working with this code. My guess is someone good at JS could supply a fix (e.g. only assign the src= attribute after the user has clicked), but that’s not my forte.
Correct. This was one of the few times Coothead was wrong. (I did pose this question back around Christmas.)
Based on my research tonight, CSS only affects the “presentation” and as long as an < img > element has a src then the image gets downloaded.
Correct.
Yep, that is the same conclusion/solution I would propose.
Maybe I can get some kind soul to help me in the morning ver in the Javascript forum? (I don’t know a lick of Javascript…)
If/when I get this latest issue resolved, and I resize all of my thumbnails to around 80KB and my detailed photos to around 200KB, I wonder if that is enough to make my site usable?
I am still interested in learning AMP - great suggestion @John_Betong - but that is going to take a while and probably longer than I have for this overdue project.
I really hope I can get some help with the Javascript and it makes things “good enough” for now.
Then maybe I can learn AMP at my leisure and focus it more towards my e-commerce site which I really should be working on now as I type this!!
Perhaps this link would help to solve the JavaScript loading problem.
I have also updated the AMP Demo and think it is a little more simpler.
There is no need to change the URL for either the Localhost or Online images because I have used $_SESSION['HTTP_REFERER']' to automatically select the correct URL.
I have also changed the index.php and separated the menu to show how the $_GET['get']; parameter are used to select different body contents.
I would be grateful for a list of public images that could replace my selected images.
Please try post #32 again and open both in a new tab.
I have tested the download and the link, both work ok. Also the online download link works ok.
I just noticed the online web page opens the menu and the highlight index.php source code twice! I will fix it tomorrow because it is very late in the day here.
Edut:
Don’t forget to include links to public images and I will use them on my site… or blur the party images would be even better.
Thanks for trying to help. I will be reading up on AMP this weekend. But what I’d really like to get help with first is fixing the Javascript issue. I know the steps needed to fix things, but don’t have the Javascript know-how to make things work.