View Full Version : Rotate Photos
FBRN_Andrew
10-15-2013, 12:11 PM
I've looked through and search, for a mod that would allow users and/or moderators to be able to rotate pictures. a VERY high percentage of our pictures are from cell phones now and end up rotating to the wrong orientation. is there a mod/hack add-in that would add simple rotate left/right to pictures?
Sorry if I'm just not finding it. but I'd love this ability.
Were you thinking of having the option to do it as they're uploaded? Maybe I can look at doing something.
FBRN_Andrew
10-15-2013, 01:18 PM
Were you thinking of having the option to do it as they're uploaded? Maybe I can look at doing something.
That would be awesome, it's so annoying, to have all the sideways pictures, and I can't seem to find a way to rotate them.
makes me nutz, the forum I admin (haha or maybe I should say am learning to admin) is very picture centric, and now the percentage of sideways pictures keeps going up as more and more phones get taller.
if you're looking for a wish list, being able to let user orient the picture would be huge, allowing moderators to go in and orient would be super helpful, a lot of our users can barely navigate the forum, much less options.
--super awesome bonus would be if I'd also love to see a image quality control, one of my other pet-peaves with current photo's is the amazing number of 10 megapixel blurry pics, it'd be super nice to scale them down to like 40kb, (about what most of them are actually quality wise)
-- just wishing now though :)
--------------- Added 1381847197 at 1381847197 ---------------
just to be clear -- anything would help so if it's just during the upload process it'd still be huge.
it's been an issue since we started the forum especially with Iphones, I'm surprised I couldn't find tons of threads and mods for it. maybe we just post a lot more pictures than most forums.
OK, well, I can't promise anything but it sounds like something that would be useful to a lot of people so I'll look in to it.
OK, I have a question: right now if you're editing a post and you double click an attachment it pops up a dialog that has some options. I think I can add to that or add a similar control. But sometimes I feel like the only person in the world who isn't using forums on a phone, so I have no idea if the editor even works on people's phones. Does it? And if not, do you feel like you need some way for people to do this from their phones? If so, maybe it doesn't make sense for me to try to do this.
FBRN_Andrew
10-15-2013, 05:04 PM
for me personally, I think it'd be great, especially if it can be done after the post is up.
as for the phone editing, most of our users are on tapatalk or forum runner, so my knee jerk reactions is let them code their own apps.
but if it would only be possible to add on the intital post, I'd say don't waste your time, if I can go in and fix existing pictures, I'd think it'd be awesome... like the sort of thing I'd pay for actually.
but if it would only be possible to add on the intital post, I'd say don't waste your time, if I can go in and fix existing pictures, I'd think it'd be awesome... like the sort of thing I'd pay for actually.
OK, what I was thinking is adding to or making something similar to the existing dialog that pops up when you double click an image in the editor (when editing a post). So if I understand you, that's the kind of thing you're looking for, so I'll go ahead and see what I can come up with.
FBRN_Andrew
10-15-2013, 05:12 PM
yes that would be great, most especially if moderators could do it also. but if just each user could fix there own, still huge.
I have noticed "most of the time" when I put pictures from my phone into the forum, they "look" right untill a post and refresh. so again, if it's only on initial upload it'd have to have a "this side up" check box or something or it'd be a big time soak and might make it worse :-)
OK, here's a first version, attached, if anyone wants to test it out. Might be a good idea to limit testing to one image or a test thread at least until you make sure it works.
To use this, install the product then edit a post with an attachment and double click the attachment. You should get the existing "attachment config" editor popup (Edit: actually it's called "Image Settings"), and it should have an added row of radio buttons for "Rotation". Select a rotation angle, press "Save" in the popup, press "Save" to save the edit, then refresh the browser (Ctrl-F5 in FF).
There are a couple of issues: because of the way attachments are inserted in posts, you won't see the rotated image until you force a reload of the page and bypass the browser cache. You can fix that issue by editing the file includes/class_bbcode_alt.php and making these changes (sorry, couldn't do it with a plugin):
Around line 245, find this code and add the part in red (including the comma):
$attachments = $vbulletin->db->query_read_slave("
SELECT a.settings, a.attachmentid, a.filename, a.dateline
FROM " . TABLE_PREFIX . "attachment AS a
WHERE
a.attachmentid IN (" . implode(',', $matches[1]) . ")
LIMIT 50
");
Then around line 260 find this code and change part in red:
$attribs = array(
'src' => $vbulletin->options['bburl'] . '/attachment.php?attachmentid=' . $attachmentid . '&stc=1&d='.$ids[$attachmentid]['dateline'],
'attachmentid' => $attachmentid,
'alt' => '',
'id' => 'vbattach_' . $attachmentid,
);
(note that the above change is really two additions, &d= before the existing single quote, and the rest after the quote and before the existing comma).
You don't have to make those changes, but again if you don't you won't see the rotated image until you force a refresh (Ctrl-F5).
Also, when you're in the editor you won't see the image rotated in the editor until you hit save (I'm still working on that one).
One other thing: this only works if you have the GD library configured in your php. If someone's using Imagmagick instead I might be persuaded to add support for that.
I'll be releasing this as a mod soon, but was hoping to get at least one person to test it first.
[Edit: removed attachment, not working]
FBRN_Andrew
10-22-2013, 04:10 PM
Awesome. thanks. pretty straight forward and self explanatory dialog. but it's not working on my forum, I'm sure I'm doing something wrong. but I've even open the page I edidted on another machine. and pretty sure it's not browser cache. should the rotation dialogue go back to "none" or is it supposed to hold the rotation setting?
It should hold the setting, so apparently it's bailing out at some point.
If you want you could try going to the admincp, and at or near the bottom of the list there should be a "kh99 Rotate Attachment" setting page. There you can turn on debugging and specify a file to write the messages to. It has to be a writable directory. If your server is set up so that the web server process can write to the forum directories then you can just put a file name, otherwise you'll need a path to somewhere with write permission.
Do you know if you have GD configured? You can go to Maintenance > View PHP Info and see if it's listed in the configuration (there'll be a section with GD at the top, for me it's between ftp and gettext).
...also, do you know which version of vbulletin and php you're running?
FBRN_Andrew
10-22-2013, 04:46 PM
PHP 5.3.26
VBulletin 4.2.2
I made a directory set it to 755 and a file also 755 and nothing's going in the file.
I'm _not_ much of a coder, or web guy, so I'm not sure I did it correctly.
I'm more than willing to work on testing but it might be easier to PM me instructions and we can post what's needed without me fumbling around or possibly confusing things on the forum.
--------------- Added 1382464151 at 1382464151 ---------------
GD Support enabled
GD Version bundled (2.1.0 compatible)
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.4.2
T1Lib Support enabled
GIF Read Support enabled
GIF Create Support enabled
JPEG Support enabled
libJPEG Version 6b
PNG Support enabled
libPNG Version 1.2.44
WBMP Support enabled
XBM Support enabled
jjohns12
12-06-2013, 05:52 PM
I have been looking for a mod like you are making and i am using imagemagic please add support for that.
Thanks
I'll try to do that. I actually have a version of this mod that works for me (using GD), but FBRN_Andrew who volunteered to test it for me couldn't get it to work at all on his server, so it's been on hold.
tbworld
12-07-2013, 05:41 AM
I'll try to do that. I actually have a version of this mod that works for me (using GD), but FBRN_Andrew who volunteered to test it for me couldn't get it to work at all on his server, so it's been on hold.
@KH99, I will give it a whirl if you would like. I think this would be used by many of the users if we worked out the kinks, if there is any. :)
@KH99, I will give it a whirl if you would like. I think this would be used by many of the users if we worked out the kinks, if there is any. :)
OK, I'm attaching the latest (still GD only). Instead of repeating the instructions I'll refer you to post #9 in this thread.
It takes some time to rotate an image and there's no feedback, so if you press "OK" in the dialog and it looks like it hangs, it may just be taking a long time (also read the "There are a couple of issues:.." paragraph in post #9).
tbworld
12-07-2013, 10:58 AM
Thanks @Kh99, I am pretty sure I will figure it out. I already read through the thread prior to replying the first time. I dislike wasting your time or mine. :)
Let me get this running and if you want I have some image magic code that I created/altered on another project, that we could patch in to your code. Famous last words, now I will have to find it. :)
Big Al
12-07-2013, 10:55 PM
Until you get it sorted you can load the images into Imageshack and rotate them easily.
Then you can use them however you wish. Re- post them using imageshack or copy and paste.
Yeah, but I think the original post mentioned that people post from phones so they don't want to go through all that, and moderators don't either. But that reminds me of something I thought of while doing this: I think pictures coming from phones sometimes contain information about the orientation, and the real problem is that it's being ignored (although I think I read that the latest IE will see it and rotate the image accordingly). So maybe a simpler mod might be when someone uploads a jpeg, look for the orientation tag and rotate the image if necessary.
Big Al
12-07-2013, 11:37 PM
just to be clear -- anything would help so if it's just during the upload process it'd still be huge.
The OP said anything would help. While not a perfect answer, it should allow the images to be rotated and this is what the OP asked for.
Until a better solution is forthcoming this should allow the OP to do what was requested.
Hello,
I know this thread is old and I didn't want to bring back to the top but I couldn't find anything else. This is for vb4 but will it work with vb3?
I forgot about this thread, but a while back I did this mod: https://vborg.vbsupport.ru/showthread.php?t=318291 which does what I mentioned above (rotates the image when uploading), but it only works if you have ImageMagick available (I think some shared hosts might have it available, even if you're currently using GD for other image processing). I believe it will work as is for vb3, even though I didn't release it under vb3.
Oh, the above (the one you asked about) won't work for vb3 beause it depends on the ckeditor in vb4.
PinkMilk
05-18-2015, 02:18 PM
Jquery click image to rotate:
var angle = 90;
$('#rightwayup').on("click", function() {
$(this).css({
'-webkit-transform': 'rotate(' + angle + 'deg)',
'-moz-transform': 'rotate(' + angle + 'deg)',
'-o-transform': 'rotate(' + angle + 'deg)',
'-ms-transform': 'rotate(' + angle + 'deg)'
});
angle += 90;
});
<img id="rightwayup" src="http://i.imgur.com/3nTTzTd.png" alt="" />
#rightwayup {
position:fixed;
-webkit-transition: all .5s ease-out;
-moz-transition: all .5s ease-out;
-ms-transition: all .5s ease-out;
-o-transition: all .5s ease-out;
transition: all .5s ease-out;
}
Not tested in vbulletin and probably conflicts with something like prev/next but hey its just my 2 cents,
jsfiddle demo (http://jsfiddle.net/5b7rb3u8/4/)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.