Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $nenini=false;
- echo render_images();
- function create_thumb($src,$dest,$desired_width = false, $desired_height = false)
- {
- /*If no dimenstion for thumbnail given, return false */
- if (!$desired_height&&!$desired_width) return false;
- $fparts = pathinfo($src);
- $ext = strtolower($fparts['extension']);
- /* if its not an image return false */
- if (!in_array($ext,array('gif','jpg','png','jpeg'))) return false;
- /* read the source image */
- if ($ext == 'gif')
- $resource = imagecreatefromgif($src);
- else if ($ext == 'png')
- $resource = imagecreatefrompng($src);
- else if ($ext == 'jpg' || $ext == 'jpeg')
- $resource = imagecreatefromjpeg($src);
- $width = imagesx($source_image);
- $height = imagesy($source_image);
- /* find the "desired height" or "desired width" of this thumbnail, relative to each other, if one of them is not given */
- if(!$desired_height)
- $desired_height = floor($height*($desired_width/$width));
- if(!$desired_width)
- $desired_width = floor($width*($desired_height/$height));
- /* create a new, "virtual" image */
- $virtual_image = imagecreatetruecolor($desired_width,$desired_height);
- if($width<$desired_width){
- $desired_width=$width;
- $desired_height=$height;
- }
- /* copy source image at a resized size */
- imagecopyresized($virtual_image,$resource,0,0,0,0,$desired_width,$desired_height,$width,$height);
- /* create the physical thumbnail image to its destination */
- /* Use correct function based on the desired image type from $dest thumbnail source */
- $fparts = pathinfo($dest);
- $ext = strtolower($fparts['extension']);
- /* if dest is not an image type, default to jpg */
- if (!in_array($ext,array('gif','jpg','png','jpeg'))) $ext = 'png';
- $dest = $fparts['dirname'].'/'.$fparts['filename'].'.'.$ext;
- if ($ext == 'gif')
- imagegif($virtual_image,$dest);
- else if ($ext == 'png')
- imagepng($virtual_image,$dest,1);
- else if ($ext == 'jpg' || $ext == 'jpeg')
- imagejpeg($virtual_image,$dest,100);
- return array(
- 'width' => $width,
- 'height' => $height,
- 'new_width' => $desired_width,
- 'new_height'=> $desired_height,
- 'dest' => $dest
- );
- }
- function render_images()
- {
- global $nenini;
- $ret='';
- $nenini['image.wild']='*.png';
- $nenini['title']='Image Archives';
- $ret.=
- '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">'.
- '<html>'.
- '<head>'.
- '<title>'.
- $nenini['title'].
- '</title>'.
- '</head>'.
- '<style media="screen" type="text/css">'.
- '@import "style.css";'.
- '</style>'.
- '<script language="JavaScript" src="index.js"></script>'.
- '<script src="/Glow JS 0-01/Glow JS 0-00 Parallax.js" language="JavaScript"></script>'.
- '<body link="grey" alink="grey" vlink="grey" onload="JsParallax_ini();">'.
- '<table border="0px" cellpadding="8px" cellspacing="4px" width="100%">'.
- '<tr>'.
- '<td colspan="2">'.
- '<p><font color="red" face="Courier New" size="22pt"><b>neinstar filmz</b></font></p>'.
- '</td>'.
- '</tr>'.
- '<tr>'.
- '<td colspan="2">'.
- '<h1>'.$nenini['title'].'</h1>'.
- '</td>'.
- '</tr>'.
- '<tr>'.
- '<td>';
- $prefix='';
- $suffix=$_SERVER['SCRIPT_NAME'];
- while(strpos($suffix,'/')!==false){
- $prefix.=substr($suffix,0,strpos($suffix,'/')+1);
- $suffix=substr($suffix,strpos($suffix,'/')+1);
- if(!is_dir($prefix))
- mkdir($prefix);
- }
- echo '<h1>'.$_SERVER['DOCUMENT_ROOT'].$prefix.$nenini['image.wild'].'</h1><br>';
- $dat=glob($_SERVER['DOCUMENT_ROOT'].$prefix.$nenini['image.wild']);
- ksort($dat);
- $ret.='<table border="0px" cellspacing="8px" cellspacing="4px">';
- $ct=0;
- $temp='';
- if(!is_dir($_SERVER['DOCUMENT_ROOT'].'/thumbs/'))
- mkdir($_SERVER['DOCUMENT_ROOT'].'/thumbs/');
- foreach($dat as $fn){
- echo '"'.$fn.'"<br>';
- $ct++;
- $ct=($ct % 5);
- $src=$fn;
- $prefix='';
- $suffix=$fn;
- while(strpos($suffix,'/')!==false){
- $prefix.=substr($suffix,0,strpos($suffix,'/')+1);
- $suffix=substr($suffix,strpos($suffix,'/')+1);
- if(!is_dir($prefix))
- mkdir($prefix);
- }
- $dest=$_SERVER['DOCUMENT_ROOT'].'/thumbs'.substr($fn,strlen($_SERVER['DOCUMENT_ROOT']));
- $prefix='';
- $suffix=$dest;
- while(strpos($suffix,'/')!==false){
- $prefix.=substr($suffix,0,strpos($suffix,'/')+1);
- $suffix=substr($suffix,strpos($suffix,'/')+1);
- echo '"'.$prefix.'"<br>';
- if(!is_dir($prefix))
- mkdir($prefix);
- }
- if(!is_file($dest)){
- create_thumb($fn,$dest,240,false);
- echo '<tt>create_thumb("'.$fn.'","'.$dest.'",240,false)</tt><br>';
- }
- $temp.='<td bgcolor="black" align="center" valign="middle" class="picframe"><tt>img src="data:image/png;base64,'.base64_encode(file_get_contents($dest)).'" style="max-width: 240px;"</tt></td>';
- if($ct===0){
- '<tr>'.$temp.'</tr>';
- $temp='';
- }
- }
- if(strlen($temp)>0)
- $ret.='<tr>'.$temp.'<td colspan="'.(5-$ct).'"></td></tr>';
- $ret.=
- '</table>'.
- '<p><table border="0px" cellpadding="8px" cellspacing="4px">'.
- '<tr>'.
- '<td><div class="stats">Series</div></td>'.
- '<td><div class="stats"># Images</div></td>'.
- '</tr>'.
- '<tr>'.
- '<td align="left"><a href="./Nick/"><font size="+2">Nick</b></font></a></td>'.
- '<td align="right">4</td>'.
- '</tr>'.
- '<tr>'.
- '<td align="left"><a href="./emblems/"><font size="+2"><b>Emblems</b></font></a></td>'.
- '<td align="right">4</td>'.
- '</tr>'.
- '<tr>'.
- '<td align="left"><a href="./shiprekt/"><font size="+2"><b>JailCon / #SHIPREKT Tour</b></font></a></td>'.
- '<td align="right">165</td>'.
- '</tr>'.
- '<tr>'.
- '<td align="left"><a href="./Death\'s Embrace/"><font size="+2"><b>Death\'s Embrace</b></font></a></td>'.
- '<td align="right">4</td>'.
- '</tr>'.
- '<tr>'.
- '<td align="left"><a href="./site/"><font size="+2"><b>Site</b></font></a></td>'.
- '<td align="right">1</td>'.
- '</tr>'.
- '</table></p>'.
- '</td>'.
- '<td id="player"></td>'.
- '</tr>'.
- '<tr>'.
- '<td colspan="2"><font size="+3">(<a href="../">Back</a>)</font></td>'.
- '</tr>'.
- '</table>'.
- '</body>'.
- '</html>';
- return $ret;
- }
- ?>
Add Comment
Please, Sign In to add comment