BUG functions.inc.php v1.3.2: little HTML source misspelling BUG functions.inc.php v1.3.2: little HTML source misspelling
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

BUG functions.inc.php v1.3.2: little HTML source misspelling

Started by frankyknife, October 23, 2004, 04:18:54 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

frankyknife

Hi!
i have just checked my CPG test gallery outputs -> the html generated outputs by coppermine.

although the browser interpretation and correct display is not affected, there appears nearly on every page an error in the html source code, cause it has something to do with an image source integration (img src=) generated by 'functions.inc.php'. the height of $image_size['geom'] is not correct defined...:

a wrong " on line 1032:

// Compute image geometry based on max width / height
function compute_img_size($width, $height, $max)
{
        global $CONFIG;
       $thumb_use=$CONFIG['thumb_use'];
       if($thumb_use=='ht') {
         $ratio = $height / $max;
       } elseif($thumb_use=='wd') {
         $ratio = $width / $max;
       } else {
         $ratio = max($width, $height) / $max;
       }
       if ($ratio > 1.0) {
               $image_size['reduced'] = true;
       }
       $ratio = max($ratio, 1.0);
       $image_size['width'] = ceil($width / $ratio);
       $image_size['height'] = ceil($height / $ratio);
       $image_size['whole'] = 'width="'.$image_size['width'].'" height="'.$image_size['height'].'"';
       if($thumb_use=='ht') {
         $image_size['geom'] = '" height="'.$image_size['height'].'"';
       } elseif($thumb_use=='wd') {
         $image_size['geom'] = 'width="'.$image_size['width'].'"';
       } else {
         $image_size['geom'] = 'width="'.$image_size['width'].'" height="'.$image_size['height'].'"';
       }



       return $image_size;
}



the correct code has to look like this:

// Compute image geometry based on max width / height
function compute_img_size($width, $height, $max)
{
        global $CONFIG;
       $thumb_use=$CONFIG['thumb_use'];
       if($thumb_use=='ht') {
         $ratio = $height / $max;
       } elseif($thumb_use=='wd') {
         $ratio = $width / $max;
       } else {
         $ratio = max($width, $height) / $max;
       }
       if ($ratio > 1.0) {
               $image_size['reduced'] = true;
       }
       $ratio = max($ratio, 1.0);
       $image_size['width'] = ceil($width / $ratio);
       $image_size['height'] = ceil($height / $ratio);
       $image_size['whole'] = 'width="'.$image_size['width'].'" height="'.$image_size['height'].'"';
       if($thumb_use=='ht') {
         $image_size['geom'] = 'height="'.$image_size['height'].'"';
       } elseif($thumb_use=='wd') {
         $image_size['geom'] = 'width="'.$image_size['width'].'"';
       } else {
         $image_size['geom'] = 'width="'.$image_size['width'].'" height="'.$image_size['height'].'"';
       }



       return $image_size;
}




regards,
franky

Joachim Müller

thanks for your report. The line that actually needs changing is$image_size['geom'] = 'height="'.$image_size['height'].'"';
It has been reported before and has been changed in the cvs already.

Joachim

frankyknife

Quote from: GauGau on October 23, 2004, 07:15:50 AM
It has been reported before and has been changed in the cvs already.

Joachim

what do you mean with "cvs" ?
i have downloaded the current realease of CPG 2 days ago, there the error still exists.

(sorry for double posting, but i searched the forum before without luck!)

Casper

The cvs (concurrent versions system) is where all the files are kept, from the first to the latest versions.  it is where the devs put updated files, and it allows us to work on these files without accidentally removing work done by another dev.

The zip file you, and all other users downloaded, does not contain all the latest files, it is the same zip as when 1.3.2 was first packaged.  If we re-packaged the zip every time a file is updated, we would be on version 1.3.lots by now.
If you want any of the updated files, you can get them from the cvs, by clickin on the 'project' link in the menu above, then on 'cvs' and then 'browse the cvs'.

The branch you will want to browse for this version is the 'stable' branch.
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here