query( $sql ); $category = $db->select(); $sql = "SELECT * FROM galleria_galleria WHERE cat = " . $_GET['cat'] . " ORDER BY id ASC"; $db->query( $sql ); $images = $db->select( true ); $imgtotal = $db->query_rows; if( $imgtotal == 0 ) $curpage = 1; if( !isset( $_GET['id'] ) ) $imageid = $images[0]['id']; else { $imageid = $_GET['id']; $sql = "SELECT id FROM galleria_galleria WHERE id = " . $imageid . " AND cat = " . $_GET['cat'] . " LIMIT 1"; $db->query( $sql ); if( $db->query_rows == 0 ) $imageid = $images[0]['id']; } if( $imgtotal > 0 ) { $sql = "SELECT * FROM galleria_additional WHERE parentid = " . $imageid . " ORDER BY id ASC"; $db->query( $sql ); $addimages = $db->select( true ); foreach( $images as $num => $img ) { if( $img['id'] == $imageid ) $position = $num; } $curpage = ceil( ( $position + 1 ) / 5 ); $pages = ceil( $imgtotal / 5 ); if( !empty( $_GET['addid'] ) ) { $sql = "SELECT * FROM galleria_additional WHERE id = " . $_GET['addid'] . " AND cat = " . $_GET['cat'] . " LIMIT 1"; } else { $sql = "SELECT * FROM galleria_galleria WHERE id = " . $imageid . " AND cat = " . $_GET['cat'] . " LIMIT 1"; } $db->query( $sql ); if( $db->query_rows > 0 ) $curimage = $db->select(); else $curimage = $images[0]; $imagefound = array( 'addit' => false, 'norma' => false, 'thumb' => false, 'zfull' => false, 'zthum' => false ); if( file_exists( '../img/tuotanto/' . $category['imagedir'] . 'additional/' . $curimage['filename'] ) && !is_dir( '../img/tuotanto/' . $category['imagedir'] . 'additional/' . $curimage['filename'] ) ) $imagefound['addit'] = true; if( file_exists( '../img/tuotanto/' . $category['imagedir'] . 'normal/' . $curimage['filename'] ) && !is_dir( '../img/tuotanto/' . $category['imagedir'] . 'normal/' . $curimage['filename'] ) ) $imagefound['norma'] = true; if( file_exists( '../img/tuotanto/' . $category['imagedir'] . 'thumb/' . $curimage['filename'] ) && !is_dir( '../img/tuotanto/' . $category['imagedir'] . 'thumb/' . $curimage['filename'] ) ) $imagefound['thumb'] = true; if( file_exists( '../img/tuotanto/' . $category['imagedir'] . 'zoomfull/' . $curimage['filename'] ) && !is_dir( '../img/tuotanto/' . $category['imagedir'] . 'zoomfull/' . $curimage['filename'] ) ) $imagefound['zfull'] = true; if( file_exists( '../img/tuotanto/' . $category['imagedir'] . 'zoomthumb/' . $curimage['filename'] ) && !is_dir( '../img/tuotanto/' . $category['imagedir'] . 'zoomthumb/' . $curimage['filename'] ) ) $imagefound['zthum'] = true; if( $imagefound['norma'] ) $curimagesize = getimagesize( '../img/tuotanto/' . $category['imagedir'] . 'normal/' . $curimage['filename'] ); else $curimagesize = array( 520, 520, 2, 'width="520" height="520"' ); if( $curimage['zoom'] == 1 ) { if( $imagefound['zfull'] && $imagefound['zthum'] ) { $curzoomsize = getimagesize( '../img/tuotanto/' . $category['imagedir'] . 'zoomfull/' . $curimage['filename'] ); $curthumbsize = getimagesize( '../img/tuotanto/' . $category['imagedir'] . 'zoomthumb/' . $curimage['filename'] ); } else { $curzoomsize = array( 520, 520, 2, 'width="520" height="520"' ); $curthumbsize = array( 180, 180, 2, 'width="180" height="180"' ); } $kuvasuhdex = round( $curzoomsize[0] / $curthumbsize[0], 3 ); $kuvasuhdey = round( $curzoomsize[1] / $curthumbsize[1], 3 ); $targetkoko = round( 520 / round( ( $kuvasuhdex + $kuvasuhdey ) / 2, 3 ) ); $kokokuvapos = 340 + 180 - $curthumbsize[1]; $dragboundx = $curthumbsize[0] - $targetkoko; $dragboundy = $curthumbsize[1] - $targetkoko; } } ?> Vilho Lampi

Valitussa kategoriassa ei ole teoksia.