[Linpha-cvs] SF.net SVN: linpha: [4647] trunk/linpha2
Status: Inactive
Brought to you by:
bzrudi
From: <bz...@us...> - 2006-11-13 13:54:54
|
Revision: 4647 http://svn.sourceforge.net/linpha/?rev=4647&view=rev Author: bzrudi Date: 2006-11-13 05:54:32 -0800 (Mon, 13 Nov 2006) Log Message: ----------- fixed broken search, made image rotating by menu (partially) work Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/linpha.image.class.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/modules/module.search.php trunk/linpha2/templates/default/search.html.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-11-13 10:51:25 UTC (rev 4646) +++ trunk/linpha2/ChangeLog 2006-11-13 13:54:32 UTC (rev 4647) @@ -1,3 +1,8 @@ +2006-11-13 bzrudi + * fixed broken search + * made image ratating by menu work (there is a know problem with the aspect + ratio I will later on have a closer look) + 2006-11-12 flo * changed upload behaviour: only images and videos allowed to be uploaded if you have a public upload folder, its dangerous if the user may upload own php files! Modified: trunk/linpha2/lib/classes/linpha.image.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.image.class.php 2006-11-13 10:51:25 UTC (rev 4646) +++ trunk/linpha2/lib/classes/linpha.image.class.php 2006-11-13 13:54:32 UTC (rev 4647) @@ -482,7 +482,48 @@ } +/** + * Rotates images when called from menu direction left/right. + * Insert rotation value into linpha_photos and swap + * also image width and height in table. + * Later do a force recreate + * + * @param string $direction either 90 (right turn) or -90 (left turn) + * @param int $linID + * + */ + + function rotateImageByMenuCall($direction, $linId) + { + /** + * Insert ration value in linpha_photos + */ + $rotate = $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."photos " . + "SET rotate='".$direction."' " . + "WHERE id='".$linId."'"); + + /** + * Swap image width and height + */ + $imagedata = $GLOBALS['linpha']->db->GetRow("SELECT width AS width, height AS height " . + "FROM ".LIN_PREFIX."photos " . + "WHERE id='".$linId."' "); + + $swap = $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."photos SET " . + "width = '".$imagedata['height']."', " . + "height = '".$imagedata['width']."' " . + "WHERE id='".$linId."'"); + + /** + * force recreate with new values + */ + $thumbnail = new LinImage(); + $_GET['force'] = true; + $thumbnail->createThumbnail( $linId ); + } + + /** * returns the full path to the cached image * in thumb mode, $id is the photoid Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-11-13 10:51:25 UTC (rev 4646) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-11-13 13:54:32 UTC (rev 4647) @@ -436,9 +436,9 @@ { $GLOBALS['linpha']->template->output['menu_More']['edit']['name'] = i18n("Edit"); $GLOBALS['linpha']->template->output['menu_More']['edit']['value'][0]['name'] = i18n("Rotate Left"); - $GLOBALS['linpha']->template->output['menu_More']['edit']['value'][0]['value'] = '#'; + $GLOBALS['linpha']->template->output['menu_More']['edit']['value'][0]['value'] = LINPHA_LINK.'&linCat=alb&linId='.$GLOBALS['linpha']->template->idCurrent.'&admin_cmd=rotate_left'; $GLOBALS['linpha']->template->output['menu_More']['edit']['value'][1]['name'] = i18n("Rotate Right"); - $GLOBALS['linpha']->template->output['menu_More']['edit']['value'][1]['value'] = '#'; + $GLOBALS['linpha']->template->output['menu_More']['edit']['value'][1]['value'] = LINPHA_LINK.'&linCat=alb&linId='.$GLOBALS['linpha']->template->idCurrent.'&admin_cmd=rotate_right';; } if($GLOBALS['linpha']->sql->photoIsAllowed( $this->id_parent, 'write')) @@ -554,9 +554,15 @@ } break; case 'rotate_left': + if($GLOBALS['linpha']->sql->isAdmin()) + { + LinImage::rotateImageByMenuCall('-90', $GLOBALS['linpha']->template->idCurrent); + } + break; case 'rotate_right': if($GLOBALS['linpha']->sql->isAdmin()) { + LinImage::rotateImageByMenuCall('90', $GLOBALS['linpha']->template->idCurrent); } break; case 'basket_add_all': Modified: trunk/linpha2/lib/modules/module.search.php =================================================================== --- trunk/linpha2/lib/modules/module.search.php 2006-11-13 10:51:25 UTC (rev 4646) +++ trunk/linpha2/lib/modules/module.search.php 2006-11-13 13:54:32 UTC (rev 4647) @@ -246,7 +246,7 @@ * exif/iptc/xmp */ include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); - $MetaData = new MetaData(); + $MetaData = new LinMetaData(); /** * exif @@ -433,9 +433,7 @@ (isset($need_iptc_table) ? "LEFT OUTER JOIN ".LIN_PREFIX."meta_iptc ON ".LIN_PREFIX."photos.md5sum = ".LIN_PREFIX."meta_iptc.md5sum " : ''). "WHERE ".$sql_buttons.$sql_categories.$sql_exif_date.$sql_albums.'1=1'; - $linpha->db->debug = true; $linpha->imgview->photos = $GLOBALS['linpha']->db->GetAssoc($sql_begin.$sql_where); - $linpha->db->debug = false; if( count($linpha->imgview->photos) == 0 ) { @@ -448,7 +446,7 @@ } $GLOBALS['linpha']->template->output['navigation'] .= '<a class="button" href="'.LINPHA_LINK.'&linCat=search&cmd=new">'. - i18n("New Search").'</a>'. + i18n("New Search").'</a> '. '<a class="button" href="'.LINPHA_LINK.'&linCat=search&cmd=edit">'. i18n("Edit Search").'</a>'; Modified: trunk/linpha2/templates/default/search.html.php =================================================================== --- trunk/linpha2/templates/default/search.html.php 2006-11-13 10:51:25 UTC (rev 4646) +++ trunk/linpha2/templates/default/search.html.php 2006-11-13 13:54:32 UTC (rev 4647) @@ -79,7 +79,7 @@ } include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); - $MetaData = new MetaData(); + $MetaData = new LinMetaData(); /** * Exif/Iptc/Xmp Informations This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |