]> git.mxchange.org Git - friendica.git/commitdiff
allow rotation either CW or CCW
authorZach Prezkuta <fermion@gmx.com>
Thu, 21 Jun 2012 02:36:10 +0000 (20:36 -0600)
committerZach Prezkuta <fermion@gmx.com>
Thu, 21 Jun 2012 02:51:03 +0000 (20:51 -0600)
mod/photos.php
view/photo_edit.tpl

index 91adbb33b7dd479ac0a992a7c109bd6c816831f8..d96bc135e4133d62eabfd126e725a72f051993e0 100644 (file)
@@ -306,7 +306,8 @@ function photos_post(&$a) {
                        $albname = datetime_convert('UTC',date_default_timezone_get(),'now', 'Y');
 
 
-               if((x($_POST,'rotate') !== false) && (intval($_POST['rotate']) == 1)) {
+               if((x($_POST,'rotate') !== false) && 
+                  ( (intval($_POST['rotate']) == 1) || (intval($_POST['rotate']) == 2) )) {
                        logger('rotate');
 
                        $r = q("select * from photo where `resource-id` = '%s' and uid = %d and scale = 0 limit 1",
@@ -316,7 +317,8 @@ function photos_post(&$a) {
                        if(count($r)) {
                                $ph = new Photo($r[0]['data'], $r[0]['type']);
                                if($ph->is_valid()) {
-                                       $ph->rotate(270);
+                                       $rotate_deg = ( (intval($_POST['rotate']) == 1) ? 270 : 90 );
+                                       $ph->rotate($rotate_deg);
 
                                        $width  = $ph->getWidth();
                                        $height = $ph->getHeight();
@@ -325,8 +327,8 @@ function photos_post(&$a) {
                                                dbesc($ph->imageString()),
                                                intval($height),
                                                intval($width),
-                               dbesc($resource_id),
-                               intval($page_owner_uid)
+                                               dbesc($resource_id),
+                                               intval($page_owner_uid)
                                        );
 
                                        if($width > 640 || $height > 640) {
@@ -338,8 +340,8 @@ function photos_post(&$a) {
                                                        dbesc($ph->imageString()),
                                                        intval($height),
                                                        intval($width),
-                               dbesc($resource_id),
-                               intval($page_owner_uid)
+                                                       dbesc($resource_id),
+                                                       intval($page_owner_uid)
                                                );
                                        }
 
@@ -352,8 +354,8 @@ function photos_post(&$a) {
                                                        dbesc($ph->imageString()),
                                                        intval($height),
                                                        intval($width),
-                               dbesc($resource_id),
-                               intval($page_owner_uid)
+                                                       dbesc($resource_id),
+                                                       intval($page_owner_uid)
                                                );
                                        }       
                                }
@@ -1251,7 +1253,8 @@ function photos_content(&$a) {
                        $edit_tpl = get_markup_template('photo_edit.tpl');
                        $edit = replace_macros($edit_tpl, array(
                                '$id' => $ph[0]['id'],
-                               '$rotate' => t('Rotate CW'),
+                               '$rotatecw' => t('Rotate CW (right)'),
+                               '$rotateccw' => t('Rotate CCW (left)'),
                                '$album' => template_escape($ph[0]['album']),
                                '$newalbum' => t('New album name'), 
                                '$nickname' => $a->data['user']['nickname'],
index f6059a7ecc2212f4af76c9c1db9d7f7c09021a98..85d5fb8e29cd9e7c5e582883d9fb234aeefc31d6 100644 (file)
 
        <div id="photo-edit-tags-end"></div>
        <div id="photo-edit-rotate-wrapper">
-               <div id="photo-edit-rotate-label">$rotate</div>
-               <input type="checkbox" name="rotate" value="1" />
+               <div id="photo-edit-rotate-label">
+                       $rotatecw<br>
+                       $rotateccw
+               </div>
+               <input type="radio" name="rotate" value="1" /><br>
+               <input type="radio" name="rotate" value="2" />
        </div>
        <div id="photo-edit-rotate-end"></div>