Helping a Graphic-Intensive Website

Derek0

New Member
Reaction score
1
So, I have this website that allows the users to make a map based on placing images on ground, mask, or fringe layers. They select their "tiles" from a bunch of images, place them somewhere on a layer, and then repeat. All using JavaScript.

The problem is, when the user tries to scroll through their creation, all the images give the browser a hard time and it scrolls really slow. I guess I knew I would run into this anyway.

So, is there anything I can do to make this graphic intensive website scroll easier to the browser, other then making it less graphic intensive? Here are a few questions but if you know any other ways please post:

  • If I used PNGs instead of GIFs, would it scroll faster? (I need transparency)
  • If I make the div they scroll through smaller, showing less images at a time, would it scroll faster? (there will still be as many images, just not visible)
  • If I changed the quality or image size of the images, would it scroll faster?
  • Is there a way to tell the browser to do something different for it to scroll faster?

Thanks in Advace :)

P.S. Please don't tell me to do it in Flash or Java instead, I won't go into detail, but it has to be JavaScript or my whole project is pointless.
 

enouwee

Non ex transverso sed deorsum
Reaction score
240
The key is anticipation (or: prefetching).

If you understand how the AJAX version of Google Maps works, you should known what I mean.
 

Derek0

New Member
Reaction score
1
The key is anticipation (or: prefetching).

If you understand how the AJAX version of Google Maps works, you should known what I mean.

So, only display what's visible and fetch the images ajacent to the visible area? That could work, I should try it, thanks.

By the way, do I have to use AJAX, or can I just use innerHTML to add the images, or can I just make them there but invisible until they're needed?
 

phyrex1an

Staff Member and irregular helper
Reaction score
447
It sounds as you only have a limited set of images that can be combined in many different ways. Currently you do that combining on the server, sending the combined image to the browser. Eg,
PHP:
<img src="/combine?images=A-B-C" alt="">

Though, you could let the browser deal with the combining making the total amount of different images to download way smaller.
PHP:
<img src="A.gif" alt=""><img src="B.gif" alt=""><img src="C.gif" alt=""><!-- TODO: Invent the uber css/javascript used to stack these images -->

Might be an option if I did understand you application correctly :)
 

enouwee

Non ex transverso sed deorsum
Reaction score
240
By the way, do I have to use AJAX, or can I just use innerHTML to add the images, or can I just make them there but invisible until they're needed?

Well, if your client-side scripts know what to request next, you don't need AJAX and simple DOM calls (or innerHTML hacks) can do the job. But if only your server knows the data to display, you have to make AJAX calls.
 

Derek0

New Member
Reaction score
1
It sounds as you only have a limited set of images that can be combined in many different ways. Currently you do that combining on the server, sending the combined image to the browser.

There's a list of images, and the user can choose from them and place them on a grid in one of the three layers. Every image is 32x32 but they can be transparent. The ground layer images have a z-index of -4, mask -2, and the fringe images have a z index of 2, allowing a 3 layer effect. I'm not combining them, just placing them on the page according to the grid, with different z-indexes.

Well, if your client-side scripts know what to request next, you don't need AJAX and simple DOM calls (or innerHTML hacks) can do the job. But if only your server knows the data to display, you have to make AJAX calls.

Actually I load the images into an array at the beginning of the page, so I don't have to call MySQL as much. So yeah, I could use the DOM calls/innerHTML.

The only thing was I was making it in a fullscreen page, I guess I can't do that or it'll show too many images at once and it will be too hard to scroll. Oh well.
 

Derek0

New Member
Reaction score
1
I hope it's OK to revive my thread, but the adjustment to a non-fullscreen GUI isn't going so well.

I want to know if there's any way to speed up the scrolling without showing less images. I want to know if any of these work for that or if you know anything else please tell me.

  • If I used PNGs instead of GIFs, would it scroll faster? (I need transparency)
  • If I changed the quality or image size of the images, would it scroll faster?
  • Is there a way to tell the browser to do something different for it to scroll faster?

Also:
  • If I made the images 64x64 instead of 32x32, and showed 1/4th of them, would it scroll faster?
  • If I viewed the page on a newer computer (better ram, processor, video card, etc.) would it scroll faster?
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top