Click to See Complete Forum and Search --> : Detecting Length of a Page, is that possible?


cdp103188
11-04-2007, 12:10 AM
Ok, so I am building a hunting website, and hunters like pictures. I want to write a code that will detect the length of the page they are on, divide it by the size of the thumbnail and decide how many images to insert onto the page in order to go from top to bottom, but no more or less.

I have already coded the random images and the math calculations and whatnot, but for right now I just have to hardwire a number into my $pageLength variable, which of course, makes the same number of images appear on every page ignoring the length of the page.

Is there a way to detect and store the length of the current page in pixels?

scragar
11-04-2007, 01:25 AM
since page size varies based on font size, browser choice and the possibility of various addons that could vary the page rendering there is no method by which you gen get the size of the page server side, and grabbing the size client side will only lead to compatibility issues.

you can however use PHPs image functions in order to read in the height of an image should you wish to base your calculations on such a thing.

cdp103188
11-04-2007, 08:14 AM
That makes sense. Thanks.