By definition, no. You can reliably tell the height of a web page only after it has been rendered, because the rendering engine decides how it is going to interpret the markup provided.
PHP does not have a HTML rendering engine, so it's impossible to tell a page height using PHP.
You need to utilize your snapshot application for this. Only the renderer built into that app can give you reliable info about how tall the web page is going to be in the end result.
Don't forget the page height can vary even between different versions of the same browser (most prominently, Internet Explorer) depending on how margin
padding
etc. are interpreted.
If the images that the snapshot app produces have too much space to the bottom, consider using ImageMagick and its -trim
option that can remove excess space from images.