I had a mod set on restricting image sizes on my 6.5.5 board so images wouldn't run off the page or rather force a scroll of the entire topic/thread. I didn't put it back in for 7.1 because I think Rick handles this in the code (am I right on that?).
But maybe this would also help to set code to check for the image size on uploading in editbasic?
Here are the two code pieces I used. I don't know the original author or I would give them credit.
The first one is in a file called "checkimages.php"
<?php
/*~~~ begin configuration settings ~~~*/
/* maximum number of images per post */
$config['MaxImages']= 20;
/* maximun width of images in pixels */
$config['ImageWidth'] = 850;
/* maximun height of images in pixels */
$config['ImageHeight'] = 1400;
/* maximum image size in kilobytes*/
$config['ImageSize'] = 384;
/*~~~ end configuration settings ~~~*/
$ubbt_lang['ImageLimits'] = "
One or more images are not within the size limits !<br>
The maximum allowed image width is <b>{$config['ImageWidth']}</b> pixels.<br>
The maximum allowed image height is <b>{$config['ImageHeight']}</b> pixels.<br>
The maximum allowed file size is <b>{$config['ImageSize']}</b> kilobytes.
";
$ubbt_lang['MaxImages'] = "
Too many images! <br>
The maximum number of images in one post is <b>{$config['MaxImages']}</b><br>
";
$images = preg_match_all("/(\[IMG\]|\[{$ubbt_lang['TEXT_IMAGE']}\])http([^\[]*)\.(gif|jpg|png)(\[\/IMG\]|\[\/{$ubbt_lang['TEXT_IMAGE']}\])/i",$Body,$out,PREG_SET_ORDER);
if($images) {
for($n=0 ; $n < $images ; $n++){
$imagesunique[] = "http" . $out[$n]['2'] . "." . $out[$n]['3'];
}
$imagesunique = array_values(array_unique($imagesunique));
}
if($part1 == 1) {
if ($images > $config['MaxImages']) {
$peditchange = 1;
$preview = 1;
$executionend = 1;
}
if($executionend != 1) {
for($n=0 ; $n < count($imagesunique) ; $n++){
$imageUrl = $imagesunique[$n];
$imagehw = getimagesize($imageUrl);
if ($imagehw['0'] > $config['ImageWidth']) {
$peditchange = 1;
$preview = 1;
break;
}
if ($imagehw ['1'] > $config['ImageHeight']) {
$peditchange = 1;
$preview = 1;
break;
}
$imageSize = remote_file_size($imageUrl);
if ($imageSize > $config['ImageSize']) {
$peditchange = 1;
$preview = 1;
break;
}
}
}
}
if($part2 == 1) {
if ($images > $config['MaxImages']) {
$html -> not_right ($ubbt_lang['MaxImages']."You have $images images in your post.",$Cat);
}
for($n=0 ; $n < count($imagesunique) ; $n++){
$imageUrl = $imagesunique[$n];
$imageUrlError = "<br><br>".$imageUrl." :" ;
$Error=0;
$imagehw = getimagesize($imageUrl);
if ($imagehw['0'] > $config['ImageWidth']) {
$errormessage .= "$imageUrlError<br> {$imagehw['0']} pixels wide.";
$imageUrlError = "";
}
if ($imagehw ['1'] > $config['ImageHeight']) {
$errormessage .= "$imageUrlError<br> {$imagehw['1']} pixels tall.";
$imageUrlError = "";
}
$imageSize = remote_file_size($imageUrl);
if ($imageSize > $config['ImageSize']) {
$errormessage .= "$imageUrlError<br> $imageSize kilobytes large.";
$imageUrlError = "";
}
if($imageUrlError == ""){
$redtablestart = "<table bgcolor=\"#FF0000\" cellspacing=\"10\" cellpadding=\"0\"><tr><td>";
$tablestart = "<table width=\"600\" cellspacing=\"5\" cellpadding=\"0\" class=\"lighttable\"><tr><td>";
$redtableend = "</td></tr></table>";
$ImageArray[] = "<img src=\"$imageUrl\">";
$ImageArrayReplace[]= $redtablestart."<img src=\"$imageUrl\">".$redtableend;
}
}
if($ImageArray){
$PrintBody = str_replace($ImageArray,$ImageArrayReplace,$PrintBody);
$PrintBody = $PrintBody."<br><br>".$redtablestart.$tablestart.$ubbt_lang['ImageLimits'].$errormessage.$redtableend.$redtableend;
$preview = 1;
}
}
?>
and the other file is called "remotefilesize.php"
<?php
function remote_file_size($url)
{
$head = "";
$url_p = parse_url($url);
$host = $url_p["host"];
$path = $url_p["path"];
$fp = fsockopen($host, 80, $errno, $errstr, 20);
if(!$fp)
{ return false; }
else
{
fputs($fp, "HEAD ".$url." HTTP/1.1\r\n");
fputs($fp, "HOST: dummy\r\n");
fputs($fp, "Connection: close\r\n\r\n");
$headers = "";
while (!feof($fp)) {
$headers .= fgets ($fp, 128);
}
}
fclose ($fp);
$return = false;
$arr_headers = explode("\n", $headers);
foreach($arr_headers as $header) {
$s = "Content-Length: ";
if(substr(strtolower ($header), 0, strlen($s)) == strtolower($s)) {
$return = substr($header, strlen($s));
break;
}
}
$return = round($return/1024);
return $return;
}
?>
I started to post the modifications needed in the modify post file, but I would probably have to post the entire file, so I wont do that. Maybe the above to files can help you to see how they are using it.
Fred