http://www.saxonian.co.uk/index.php?option=guest
Not the image obviously, but the size of it. I did have a code to find all of the image paths I think using preg_match and then can resize it that way. But since cassandra fell, and then I had an old backup, I've seemed to have lost that, and My last backup was either to early (before code was implemented or too late (i.e. backup after the down time).
This is my code for filling the guestbook
Code: Select all
//
// Get GuestBook
//
function get_guest_blog()
{
global $guesttable;
$sql = "SELECT * FROM " . $guesttable . " ORDER BY guest_date DESC, guest_time DESC";
$result = mysql_query($sql);
if ($result === false)
{
header("Location: index.php?error=2");
}
$nrows = mysql_num_rows($result);
print "<div align=\"center\"><a href=\"./index.php?option=guest&action=add\">Add An Entry</a></div><br /><br />";
if ($nrows == 0)
{
print "No Guest Entries Found<br />";
} else {
while ($row = mysql_fetch_array($result)) {
$text = $row['guest_text'];
$text = preg_replace("/\[img\](.*)\[\/img\]/i", "<img border=\"0\" src=\"$1\" />", $text);
$text = preg_replace("/\[center\](.*)\[\/center\]/i", "<center>$1</center>", $text);
$text = preg_replace("/\[url\](.*)\[\/url\]/i", "<a href=\"$1\">$1</a>", $text);
$text = preg_replace("/\[url=(.*)\](.*)\[\/url\]/i", "<a target=\"_blank\" href=\"$1\">$2</a>", $text);
print "<div class=\"divBox\">\n";
print "<b>" . $row['guest_name'] . "</b><br />" . $row['guest_date'] . " - " . $row['guest_time'] . "<br /><br />\n";
print "<b>" . $row['guest_title'] . "</b><br /><br />\n";
print nl2br($text) . "\n";
print "</div>\n";
}
print "<br /><div align=\"center\"><a href=\"./index.php?option=guest&action=add\">Add An Entry</a></div>";
}
}So basically I need the code to collect all of the image paths from the BBCodes, use getimagesize and then use an if, saying
if width > #pixels then
echo "<img size=" 573 px " src="image path">
or
echo "<img src="image path">
Thats about it.
Any help is apprieciated
John