Cleaned functions.
Added room for image aspect ratio. Implemented soon.
This commit is contained in:
parent
1e20121224
commit
a2a404f1da
@ -62,6 +62,8 @@
|
|||||||
define('JPEG_QUALITY', 100);
|
define('JPEG_QUALITY', 100);
|
||||||
define('REDRAW_GIF', false);
|
define('REDRAW_GIF', false);
|
||||||
|
|
||||||
|
// Display the aspect ratio in a post's file info
|
||||||
|
define('SHOW_RATIO', false);
|
||||||
|
|
||||||
define('DIR_IMG', 'src/');
|
define('DIR_IMG', 'src/');
|
||||||
define('DIR_THUMB', 'thumb/');
|
define('DIR_THUMB', 'thumb/');
|
||||||
|
@ -38,28 +38,55 @@
|
|||||||
$this->filename = $filename;
|
$this->filename = $filename;
|
||||||
}
|
}
|
||||||
public function build($index=false) {
|
public function build($index=false) {
|
||||||
$built = '
|
$built = '<div class="post reply"' . (!$index?' id="reply_' . $this->id . '"':'') . '>' .
|
||||||
<div class="post reply"' . (!$index?' id="reply_' . $this->id . '"':'') . '>
|
'<p class="intro"' . (!$index?' id="' . $this->id . '"':'') . '>';
|
||||||
<p class="intro"' . (!$index?' id="' . $this->id . '"':'') . '>
|
|
||||||
<span class="subject">
|
// Subject
|
||||||
'.$this->subject.'
|
$built .= '<span class="subject">' . $this->subject . '</span>';
|
||||||
</span>
|
// Email
|
||||||
' . ( !empty($this->email) ? '<a class="email" href="mailto:' . $this->email . '">':'') .
|
if(!empty($this->email))
|
||||||
'<span class="name">'
|
$built .= '<a class="email" href="mailto:' . $this->email . '">';
|
||||||
. $this->name .
|
// Name
|
||||||
'</span>' . (!empty($this->trip) ? ' <span class="trip">'.$this->trip.'</span>':'')
|
$built .= '<span class="name">' . $this->name . '</span>'
|
||||||
. ( !empty($this->email) ? '</a>':'')
|
// Trip
|
||||||
. ' ' . date('m/d/y (D) H:i:s', $this->time).'
|
. (!empty($this->trip) ? ' <span class="trip">'.$this->trip.'</span>':'');
|
||||||
<a class="post_no"' . ($index?'':' onclick="highlightReply(' . $this->id . ');"') . ' href="' . ROOT . DIR_RES . $this->thread . '.html' . '#' . $this->id . '">No.</a><a class="post_no"' . ($index?'':'onclick="citeReply(' . $this->id . ');"') . 'href="' . ($index?ROOT . DIR_RES . $this->thread . '.html' . '#q' . $this->id:'javascript:void(0);') . '">'.$this->id.'</a>
|
|
||||||
</p>
|
// End email
|
||||||
'.(!empty($this->file)?'<p class="fileinfo">
|
if(!empty($this->email))
|
||||||
File: <a href="' . ROOT . $this->file.'">'.basename($this->file).'</a> <span class="unimportant">('.format_bytes($this->filesize).', '.$this->filex.'x'.$this->filey.', '.$this->filename.')</span>
|
$built .= '</a>';
|
||||||
</p>
|
|
||||||
<a href="' . ROOT . $this->file.'"><img src="' . ROOT . $this->thumb.'" style="width:'.$this->thumbx.'px;height:'.$this->thumby.'px;" /></a>':'').'
|
// Date/time
|
||||||
<p class="body">
|
$built .= ' ' . date('m/d/y (D) H:i:s', $this->time);
|
||||||
'.$this->body.'
|
|
||||||
</p>
|
$built .= ' <a class="post_no"' .
|
||||||
</div><br class="clear"/>';
|
// JavaScript highlight
|
||||||
|
($index?'':' onclick="highlightReply(' . $this->id . ');"') .
|
||||||
|
' href="' . ROOT . DIR_RES . $this->thread . '.html' . '#' . $this->id . '">No.</a>' .
|
||||||
|
// JavaScript cite
|
||||||
|
'<a class="post_no"' . ($index?'':'onclick="citeReply(' . $this->id . ');"') . 'href="' . ($index?ROOT . DIR_RES . $this->thread . '.html' . '#q' . $this->id:'javascript:void(0);') . '">'.$this->id.'</a>' .
|
||||||
|
'</p>';
|
||||||
|
|
||||||
|
// File info
|
||||||
|
if(!empty($this->file)) {
|
||||||
|
$built .= '<p class="fileinfo">File: <a href="' . ROOT . $this->file .'">' . basename($this->file) . '</a> <span class="unimportant">(' .
|
||||||
|
// 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 . ')</span></p>' .
|
||||||
|
// Thumbnail
|
||||||
|
'<a href="' . ROOT . $this->file.'"><img src="' . ROOT . $this->thumb.'" style="width:'.$this->thumbx.'px;height:'.$this->thumby.'px;" /></a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Body
|
||||||
|
$built .= '<p class="body">' . $this->body . '</p></div><br class="clear"/>';
|
||||||
|
|
||||||
return $built;
|
return $built;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -223,6 +223,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function fraction($numerator, $denominator, $sep) {
|
||||||
|
$fraction = Array($numerator, $denominator);
|
||||||
|
return "{$fraction[0]}{$sep}{$fraction[1]}";
|
||||||
|
}
|
||||||
|
|
||||||
/*********************************************/
|
/*********************************************/
|
||||||
/* Fonction: imagecreatefrombmp */
|
/* Fonction: imagecreatefrombmp */
|
||||||
/* Author: DHKold */
|
/* Author: DHKold */
|
||||||
|
Loading…
Reference in New Issue
Block a user