I've been trying to pass an specific Div's height and width to a PHP code, the problem is, the page is supposed to be responsive, with div height and width changing accordingly.
How can I pass these values dynamically?
 <?php    
    /* Configuration Start */
    $thumb_directory = 'img/thumbs';
    $orig_directory = 'img/original';
    $stage_width=600;   // How big is the area the images are scattered on
    $stage_height=400;
    /* Configuration end */
    $allowed_types=array('jpg','jpeg','gif','png');
    $file_parts=array();
    $ext='';
    $title='';
    $i=0;
    /* Opening the thumbnail directory and looping through all the thumbs: */
    $dir_handle = @opendir($thumb_directory) or
 die("There is an error with your image directory!");
    $i=1;
    while ($file = readdir($dir_handle)) 
    {
        /* Skipping the system files: */
        if($file=='.' || $file == '..') continue;
        $file_parts = explode('.',$file);
        $ext = strtolower(array_pop($file_parts));
        /* Using the file name (withouth the extension) as a image title: */
        $title = implode('.',$file_parts);
        $title = htmlspecialchars($title);
        /* If the file extension is allowed: */ 
        if(in_array($ext,$allowed_types))
        {
            /* Generating random values for the position and rotation: */
            $left=rand(0,$stage_width);
            $top=rand(0,400);
            $rot = rand(-40,40);         
            /* Outputting each image: */
            echo '
            <div id="pic-'.($i++).'" class="pic" style="top:'.$top.'px;left:'.$left.'px;background:url('.$thumb_directory.'/'.$file.') no-repeat 50% 50%; -moz-transform:rotate('.$rot.'deg); -webkit-transform:rotate('.$rot.'deg);">
            <a class="fancybox" rel="fncbx" href="'.$orig_directory.'/'.$file.'" target="_blank">'.$title.'</a>
            </div>';
        }
    }
The specific variables are $stage_width and $stage_height, those are supposed to receive the div size, but as you can see, right now, all I can do is to set a static value in them.
Is there anyway to do that? Either with JS, PHP or something else entirely?
 
     
    