RC-Monster Forums  

Go Back   RC-Monster Forums > RC-Monster Area > General Discussion

Reply
 
Thread Tools Rate Thread Display Modes
Old
  (#1)
Arct1k
RC-Monster Mod
 
Arct1k's Avatar
 
Offline
Posts: 6,597
Join Date: Apr 2007
Location: NJ
02.17.2010, 04:16 PM

Why not browse dir using explorer?
   
Reply With Quote
Old
  (#2)
BrianG
RC-Monster Admin
 
BrianG's Avatar
 
Offline
Posts: 14,609
Join Date: Nov 2005
Location: Des Moines, IA
02.27.2010, 11:54 PM

Quote:
Originally Posted by kraegar View Post
...For the thumbnails not showing up until you mouse-over, that's HTML, not PHP that's biting you. Or really, Javascript. The "onmouseover" part needs to go. I don't know javascript to tell you how to replace it, though.

As for why it's stopping part way through, I can't see a reason. Is it always in the same spot?

Sorry I can't dig in more, I'm working atm :)
Tony
The onmouseover event is there because I can't get the auto-thumbnail generation to work consistently on the server. Therefore, any "thumbnails" would be simply resized images, but their file size (and therefore download time) time would not change. Showing the image only on mouseover means the page doesn't have to download images that I don't care about until I get to the image I want to see. Just a speed optimization really.

Quote:
Originally Posted by kraegar View Post
Oh, and you can definitely just put the sort($a_img) after the loop. There's no reason for it to be in the loop.
I put the sort code outside the loop, but it didn't do anything to help the speed, well, not noticeably anyway. I'm sure there is some time savings, but it's probably measured in milli-seconds.

When I took a closer look, I see that the PHP that writes the file count to the page happens after the looping, but that part is displayed right away. I can then assume that the loop and sort is not the cause of the delay or the image count at the top would be delayed as well.

So, I looked at the loop which writes the HTML to the page instead. In client-side JScript, many multiple calls to the document.write() method (which is similar to the PHP echo method) tends to be very slow. In Jscript, an easy way to speed document writing is to create a string variable, concatenate the string in the loop (creates a very large string), and then use one "document.write()" call to write that whole string to the page at once. So, I used this methodology in PHP and it seems to have speeded up things by a factor of at least 5.

There is a disadvantage to doing this though. When you use multiple write calls (document.write() in jscript, or echo in php) you see each line appear as the server writes it to the page. If you use the concatenate scheme, it IS much faster, but you only see the full page content when all the text is compiled. Not a big deal in this specific page since there are relatively few lines to work with, but if the page is huge, you'd see a blank page until the server was done processing. A way to combine the best of both worlds would be to use the concatenate scheme to compile all the text in each iteration of the loop, and just use one echo call at the end of that iteration.

Quote:
Originally Posted by Arct1k View Post
Why not browse dir using explorer?
That won't work because I shut off directory browsing on my server (for valid reasons). I could also use FTP via Explorer, but then I'd have to remember my FTP login/password wherever I happened to be, and the account info is somewhat cryptic and difficult to remember. Either way, those would just show the file names, not the image associated with them.
  Send a message via Yahoo to BrianG Send a message via MSN to BrianG  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump







Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
vBulletin Skin developed by: vBStyles.com