aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-06-20 20:34:41 -0700
committerfriendica <info@friendica.com>2012-06-20 20:34:41 -0700
commita64d0ac90542bfbd95e0391066f9722f6162b97c (patch)
tree8f81f03017620c8ebdcccb9e2217a63346c9c6f9
parentec83a62f709b93beb81b8c9d2b6323ea85eb1a64 (diff)
parent54c76ca822978ebb97cd5b6dfdff0ea3f4f4fe7c (diff)
downloadvolse-hubzilla-a64d0ac90542bfbd95e0391066f9722f6162b97c.tar.gz
volse-hubzilla-a64d0ac90542bfbd95e0391066f9722f6162b97c.tar.bz2
volse-hubzilla-a64d0ac90542bfbd95e0391066f9722f6162b97c.zip
Merge pull request #346 from fermionic/add-rotate-ccw-option
allow rotation to be either CW or CCW
-rw-r--r--mod/photos.php21
-rw-r--r--view/photo_edit.tpl8
2 files changed, 18 insertions, 11 deletions
diff --git a/mod/photos.php b/mod/photos.php
index 91adbb33b..d96bc135e 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -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'],
diff --git a/view/photo_edit.tpl b/view/photo_edit.tpl
index f6059a7ec..85d5fb8e2 100644
--- a/view/photo_edit.tpl
+++ b/view/photo_edit.tpl
@@ -18,8 +18,12 @@
<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>