$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; } $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; $hetkeKasutajaRaamatuIdParing = db_query("SELECT * FROM {node} n WHERE n.status = 1 AND n.type = 'raamat' AND n.uid = %d ORDER BY n.changed DESC LIMIT %d", $autoriId->uid, 1); $raamatuId = db_fetch_object($hetkeKasutajaRaamatuIdParing); $node = node_load($raamatuId->nid); $hetkeKasutajaRaamatuPealkirjaParing = db_query("SELECT * FROM {term_data} td WHERE td.tid=%d", $node->field_raamatu_pealkiri[0]['value']); $raamatuPealkiri = db_fetch_object($hetkeKasutajaRaamatuPealkirjaParing); if($node->field_kaanepilt[0]['filename']!=''){ $trimmed = str_replace(' ', '%20', 'http://www.raamatumaailm.ee/sites/default/files/imagecache/skaanepilt/'.$node->field_kaanepilt[0]['filename']); } $newPictureSizes = pictureSizes1($trimmed, 96); if($eesnimi==''){ $eesnimiValja=$kasutaja; } else { $eesnimiValja=$eesnimi; } $nameLength = strlen($eesnimiValja); if($nameLength<=14){ $uusEesnimiValja=$eesnimiValja; } else { $uusEesnimiValja = substr($eesnimiValja, 0, 14); $uusEesnimiValja .= '...'; } if($node!=''){ $block_content .= '
'.$uusEesnimiValja.'
'; } } $block_content .= '
'; if ($block_content == '
') { $block['subject'] = ''; $block['content'] = ''; return $block; } $block['subject'] = 'Juhuslike autorite uusimad teosed'; $block['content'] = $block_content; return $block; } }