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 < 1 || $yratio < 1) {
if($xratio < $yratio)
$resized = imagecreatetruecolor($thumbwidth,floor(imagesy($img)*$xratio));
else
$resized = imagecreatetruecolor(floor(imagesx($img)*$yratio), $thumbheight);
imagecopyresampled($resized, $img, 0, 0, 0, 0, imagesx($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.