From a2a404f1daca791b0345ce76de3b3fcbd26d3004 Mon Sep 17 00:00:00 2001 From: Savetheinternet Date: Thu, 4 Nov 2010 03:10:47 +1100 Subject: [PATCH] Cleaned functions. Added room for image aspect ratio. Implemented soon. --- inc/config.php | 2 ++ inc/display.php | 71 ++++++++++++++++++++++++++++++++++++++----------------- inc/functions.php | 5 ++++ 3 files changed, 56 insertions(+), 22 deletions(-) diff --git a/inc/config.php b/inc/config.php index 54180153..44dc60ec 100644 --- a/inc/config.php +++ b/inc/config.php @@ -62,6 +62,8 @@ define('JPEG_QUALITY', 100); define('REDRAW_GIF', false); + // Display the aspect ratio in a post's file info + define('SHOW_RATIO', false); define('DIR_IMG', 'src/'); define('DIR_THUMB', 'thumb/'); diff --git a/inc/display.php b/inc/display.php index a1bfd2f5..20e8b16d 100644 --- a/inc/display.php +++ b/inc/display.php @@ -38,28 +38,55 @@ $this->filename = $filename; } public function build($index=false) { - $built = ' -
-

- - '.$this->subject.' - - ' . ( !empty($this->email) ? '':'') - . ' ' . date('m/d/y (D) H:i:s', $this->time).' - No.'.$this->id.' -

- '.(!empty($this->file)?'

- File: '.basename($this->file).' ('.format_bytes($this->filesize).', '.$this->filex.'x'.$this->filey.', '.$this->filename.') -

- ':'').' -

- '.$this->body.' -

-

'; + $built = '
' . + '

'; + + // Subject + $built .= '' . $this->subject . ''; + // Email + if(!empty($this->email)) + $built .= ''; + + // Date/time + $built .= ' ' . date('m/d/y (D) H:i:s', $this->time); + + $built .= ' No.' . + // JavaScript cite + ''.$this->id.'' . + '

'; + + // File info + if(!empty($this->file)) { + $built .= '

File: ' . basename($this->file) . ' (' . + // Filesize + format_bytes($this->filesize) . ', ' . + // File dimensions + $this->filex . 'x' . $this->filey; + // Aspect Ratio + if(SHOW_RATIO) { + $fraction = fraction($this->filex, $this->filey, ':'); + $built .= ', ' . $fraction; + } + // Filename + $built .= ', ' . $this->filename . ')

' . + // Thumbnail + ''; + } + + // Body + $built .= '

' . $this->body . '


'; + return $built; } }; diff --git a/inc/functions.php b/inc/functions.php index 0c14ee18..1409c7b1 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -222,6 +222,11 @@ return array ( $nameo ); } } + + function fraction($numerator, $denominator, $sep) { + $fraction = Array($numerator, $denominator); + return "{$fraction[0]}{$sep}{$fraction[1]}"; + } /*********************************************/ /* Fonction: imagecreatefrombmp */