To fix the issue with photo size replace following code in /photo.php around line 50:
// Middle size calculation
$photo['width_height'] = '' ;
list( $max_w , $max_h ) = explode( 'x' , $myalbum_middlepixel ) ;
if( ! empty( $max_w ) && ! empty( $p['res_x'] ) ) {
if( empty( $max_h ) ) $max_h = $max_w ;
if( $max_h / $max_w > $p['res_y'] / $p['res_x'] ) {
if( $p['res_x'] > $max_w ) $photo['width_height'] = "width='$max_w'" ;
} else {
if( $p['res_y'] > $max_h ) $photo['width_height'] = "height='$max_h'" ;
}
}
with this code:
// Middle size calculation
$photo['width_height'] = '' ;
list( $max_w , $max_h ) = explode( 'x' , $myalbum_middlepixel ) ;
if( ! empty( $max_w ) && ! empty( $photo_obj->getVar('res_x') ) ) {
if( empty( $max_h ) ) $max_h = $max_w ;
if( $max_h / $max_w > $photo_obj->getVar('res_y') / $photo_obj->getVar('res_x') ) {
if( $photo_obj->getVar('res_x') > $max_w ) $photo['width_height'] = "width='$max_w'" ;
} else {
if( $photo_obj->getVar('res_y') > $max_h ) $photo['width_height'] = "height='$max_h'" ;
}
}
Please test it and let us know if it works.
This is what has happened:
1) GIJoe was using this code to update the count of hits:
// update hit count
$xoopsDB->queryF( "UPDATE $table_photos SET hits=hits+1 WHERE lid='$lid' AND status>0" ) ;
$prs = $xoopsDB->query( "SELECT l.lid, l.cid, l.title, l.ext, l.res_x, l.res_y, l.status, l.date, l.hits, l.rating, l.votes, l.comments, l.submitter, t.description FROM $table_photos l LEFT JOIN $table_text t ON l.lid=t.lid WHERE l.lid=$lid AND status>0" ) ;
$p = $xoopsDB->fetchArray( $prs ) ;
if( $p == false ) {
redirect_header( $mod_url.'/' , 3 , _ALBM_NOMATCH ) ;
exit ;
}
2) Wishcraft has converted it to use XOOPS API (which was a very good idea), by creating a "MyalbumPhotos" object, with a method:
function increaseHits($value = 1) {
return $GLOBALS['xoopsDB']->queryF( "UPDATE ".$GLOBALS['xoopsDB']->prefix($GLOBALS['table_photos'])." SET hits=hits+".$value." WHERE `lid`='".$this->getVar('lid'). "' AND `status` > 0" ) ;
}
3) So then he replaced the code in (1) with:
// update hit count
$photo_obj->increaseHits(1);
4) However, he didn't check if the $p variable is used anywhere else, which unfortunately was the case in the code to be replaced:
Quote:
if( ! empty( $max_w ) && ! empty( $p['res_x'] ) ) {:
As a result, the function was never executed, and the value $photo['width_height'] was never assigned.
Another problem: It seems like, when you go to:
/modules/myalbum/admin/photomanager.php
and select few pictures to delete, it deleted ALL my pictures on the test site.
I have to investigate it, but for the time being please
DO NOT USE this function on your production side.