1
Monika
Yogurt Tribes, two major issues/bugs
  • 2008/12/22 4:33

  • Monika

  • Not too shy to talk

  • Posts: 103

  • Since: 2008/12/19


Hey i noticed those bugs in yogurt:

-in Yogurt if you upload the image of the tribe, the photo will be cut, only a part of it will be shown.

-if you are anonymous and click on a tribe, you will get a blank page (even if the debug mode is On)

We will be grateful to the one who fixes this.

2
blueteen
Re: Yogurt Tribes, two major issues/bugs
  • 2008/12/23 9:58

  • blueteen

  • Quite a regular

  • Posts: 379

  • Since: 2004/7/16


Hello, in tribe.php, lines 50 to 55, replace
$uid intval($xoopsUser->getVar('uid'));
if(
$xoopsUser)
{
    if(
in_array($uid,$uids)) $xoopsTpl->assign('memberOfTribe'1);
    
$xoopsTpl->assign('useruid'$uid);
}


With :
if($xoopsUser)
{
$uid intval($xoopsUser->getVar('uid'));
    if(
in_array($uid,$uids)) $xoopsTpl->assign('memberOfTribe'1);
    
$xoopsTpl->assign('useruid'$uid);
}


But it's not perfect.
If we look at this module being anonymous, we are automatically placed on the page with user's uid #1

There is indeed a problem with resizing the image.
Because of the line 466 (yogurt_tribes.php)
$image_name $this->resizeImage2($saved_destination12580,$path_upload);


The function is line 539, in the same file
function resizeImage2($img_path$thumbwidth$thumbheight$path_upload) {


We should correct this function or simply use another.
But I do not have the level for that.

3
Monika
Re: Yogurt Tribes, two major issues/bugs
  • 2008/12/23 20:32

  • Monika

  • Not too shy to talk

  • Posts: 103

  • Since: 2008/12/19


I really wish someone will help us fix the image resizing problem.

4
blueteen
Re: Yogurt Tribes, two major issues/bugs
  • 2008/12/24 9:59

  • blueteen

  • Quite a regular

  • Posts: 379

  • Since: 2004/7/16


Hello, can you try this for the resizing problem ? (it works for me).

Edit /modules/yogurt/class/yogurt_tribes.php
Replace the whole function receiveTribe with this one
function receiveTribe($tribe_title,$tribe_desc,$tribe_img,$path_upload,$maxfilebytes,$maxfilewidth,$maxfileheight,$thumbwidth$thumbheight$pictwidth$pictheight,$change_img=1,$tribe="")
{
    global 
$xoopsUser$xoopsDB$_POST$_FILES;
    
//busca id do user logado
    
$uid $xoopsUser->getVar('uid');
    
//create a hash so it does not erase another file
    //$hash1 = date();
    //$hash = substr($hash1,0,4);
    
    // mimetypes and settings put this in admin part later
    
$allowed_mimetypes = array( 'image/jpeg''image/pjpeg');
    
$maxfilesize $maxfilebytes;
    
    
// create the object to upload
    
$uploader = new XoopsMediaUploader($path_upload$allowed_mimetypes$maxfilesize$maxfilewidth$maxfileheight);
    
// fetch the media
    
if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
        
//lets create a name for it
        
$uploader->setPrefix('tribe_'.$uid.'_');
        
//now let s upload the file
        
if (!$uploader->upload()) {
        
// if there are errors lets return them
        
        
echo "color:#FF0000; background-color:#FFEAF4; border-color:#FF0000; border-width:thick; border-style:solid; text-align:center">

".$uploader->getErrors()."

";
        return false;
        } else {
        
// now let s create a new object picture and set its variables
        
$tribe $this->create();
        
$url $uploader->getSavedFileName();
        
$tribe->setVar("tribe_title",$tribe_title);
        
$tribe->setVar("tribe_desc",$tribe_desc);
        
$uid $xoopsUser->getVar('uid');
        
$tribe->setVar("owner_uid",$uid);
        
$url $uploader->getSavedFileName();
        
$saved_destination $uploader->getSavedDestination();
        
//print_r($_FILES);
        //$this->resizeImage($saved_destination,false, $thumbwidth, $thumbheight, $pictwidth, $pictheight,$path_upload);
        //$this->resizeImage($saved_destination,true, $thumbwidth, $thumbheight, $pictwidth, $pictheight,$path_upload);
        
$image_name $this->resizeImage($saved_destination$thumbwidth$thumbheight$path_upload);
        
$tribe->setVar("tribe_img",$image_name);
        
        }
    } else {
    echo 
"color:#FF0000; background-color:#FFEAF4; border-color:#FF0000; border-width:thick; border-style:solid; text-align:center">

".$uploader->getErrors()."

";
    return false;
    }
    
$this->insert($tribe);
    return 
true;
    
    
}


In the same file, replace the whole function resizeImage with this code
function resizeImage($img$thumbwidth$thumbheight,$path_upload) {
    
    
    
$img2 $img;
    
$path pathinfo($img);
    
$img=imagecreatefromjpeg($img);
    
$xratio $thumbwidth/(imagesx($img));
    
$yratio $thumbheight/(imagesy($img));

    if(
$xratio || $yratio 1) {
        if(
$xratio $yratio)
            
$resized imagecreatetruecolor($thumbwidth,floor(imagesy($img)*$xratio));
        else
            
$resized imagecreatetruecolor(floor(imagesx($img)*$yratio), $thumbheight);
            
imagecopyresampled($resized$img0000imagesx($resized)+1,imagesy($resized)+1,imagesx($img),imagesy($img));
            
imagejpeg($resized,$path_upload."/thumb_".$path["basename"]);
            
$image_name "thumb_".$path["basename"];
            
imagedestroy($resized);
        }               
    else{
        
imagejpeg($img,$path_upload."/thumb_".$path["basename"]);
        
$image_name "thumb_".$path["basename"];
    }
    
    
imagedestroy($img);
    return 
$image_name;

}


Edit /modules/yogurt/submit_tribes.php
Replace
if ($tribes_factory->receiveTribe($tribe_title,$tribe_desc,'',$path_upload,$maxfilebytes,$maxfilewidth,$maxfileheight))


With
if ($tribes_factory->receiveTribe($tribe_title,$tribe_desc,'',$path_upload,$maxfilebytes,$maxfilewidth,$maxfileheight,$thumbwidth$thumbheight$pictwidth$pictheight))


Try to upload an image on the tribes webpage.

Login

Who's Online

367 user(s) are online (278 user(s) are browsing Support Forums)


Members: 0


Guests: 367


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits