$height && $width > $max){ $width1 = $width; $width = $max; $height = $height/($width1/$max); }elseif($width < $height && $height > $max){ $height1 = $height; $height = $max; $width = $width/($height1/$max); } $mass = array('width'=>$width, 'height'=>$height); return $mass; } $block_content .= '
'; $autoriteParing = db_query("SELECT n.nid, n.title, cta.field_author_pic_fid FROM {node} n INNER JOIN {content_type_author} cta ON n.nid=cta.nid WHERE n.type='author' AND n.status=1 ORDER BY RAND() DESC LIMIT 10"); while($autoriId = db_fetch_object($autoriteParing)){ if($autoriId->field_author_pic_fid=='NULL'){ $block_content .= $autoriId->title; } else { $autoriPildiParing = db_query("SELECT filepath FROM {files} f WHERE f.fid=".$autoriId->field_author_pic_fid." LIMIT 1"); $autoriPilt = db_fetch_object($autoriPildiParing); if($autoriPilt->filepath!=''){ $newPictureSizes = autoriPildiSuurus1('http://'.$address.'/'.$autoriPilt->filepath, 110); } else { $newPictureSizes = autoriPildiSuurus1('http://'.$address.'/sites/all/themes/raamatumaailm/images/ajutine85x85.jpg', 110); $autoriPilt->filepath = '/sites/all/themes/raamatumaailm/images/ajutine85x85.jpg'; } //$block_content .= $autoriPilt->filepath.' | '.$autoriId->title.' ... '; $block_content .= '

'.$autoriId->title.'
'; } } $block_content .= '
'; $autoriteParing = db_query("SELECT * FROM {node} n WHERE n.type='author' AND n.status=1"); $autorid = mysql_num_rows($autoriteParing); $block_content .= '
Vaata koiki ('.$autorid.')
'; $block_content .= '
'; $block_content .= '
'; /*$autoriteParing = db_query("SELECT ur.uid FROM {users_roles} ur WHERE rid=6 ORDER BY RAND() LIMIT 3"); while ($autoriId = db_fetch_object($autoriteParing)){ $puser = user_load(array('uid' => $autoriId->uid)); $kasutaja = $puser->profile_username; $eesnimi = $puser->profile_eesnimi; $picture = $puser->picture; if($picture==""){ $piltIse = ''; } else { $piltIse = ''; } if($eesnimi==''){ $eesnimiValja=$kasutaja; } else { $eesnimiValja=$eesnimi; } $nameLength = strlen($eesnimiValja); if($nameLength<=14){ $uusEesnimiValja=$eesnimiValja; } else { $uusEesnimiValja = substr($eesnimiValja, 0, 14); $uusEesnimiValja .= '...'; } $block_content .= '
'.$piltIse.'
'.$uusEesnimiValja.'
'; } $block_content .= '
';*/ if ($block_content == '
') { $block['subject'] = ''; $block['content'] = ''; return $block; } $block['subject'] = 'Juhuslikud autorid'; $block['content'] = $block_content; return $block; } }