transform plugin can now rotate and flip images

215 views
Skip to first unread message

David Dwiggins

unread,
May 3, 2010, 7:18:12 PM5/3/10
to ResourceSpace
I just committed a change to the transform plugin (in the project
trunk) that allows it to rotate and flip the resulting images.

This is not the most sophisticated implementation of this, in that
there is no real time feedback to the user. Instead, the user selects
the degree of rotation along with all the other transform parameters,
and then the rotation or flip is applied as the last step in the
process. Eventually this could be made better by dynamically redrawing
the preview version to allow the user to crop based on the
rotated/flipped version. However, this is a first step.

The option is turned on by default, but can be disabled by setting the
parameter $cropper_rotation=false; in your config file.

Questions or comments, let me know...

-David Dwiggins

--
You received this message because you are subscribed to the Google Groups "ResourceSpace" group.
To post to this group, send email to resour...@googlegroups.com.
To unsubscribe from this group, send email to resourcespac...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/resourcespace?hl=en.

njenney

unread,
May 4, 2010, 12:18:03 AM5/4/10
to ResourceSpace
David,

This is a fantastic addition. Did some testing and got some odd
results. Sometimes it works fine and but most of the time I get the
following error. It is just kind of hit or miss.

/home/site/public_html/ResourceSpace/plugins/transform/include/
transform_functions.php line 29: unlink(/home/site/public_html/
ResourceSpace/include/../filestore/tmp/transform_plugin/..)
[function.unlink]: Is a directory

Thanks.

David Dwiggins

unread,
May 4, 2010, 12:44:41 AM5/4/10
to resour...@googlegroups.com
Thanks for the heads up. There was a bug in the "garbage collector"
code that was supposed to prevent unused temp files from building up
in the temporary directory. Instead it was trying to delete the
directory itself, which it couldn't do. This should now be fixed.

Please let me know if you still have any problems...

-David

njenney

unread,
May 4, 2010, 10:28:02 AM5/4/10
to ResourceSpace
Excellent. I will give it another whirl.

Tech Patriot

unread,
May 4, 2010, 4:57:44 PM5/4/10
to ResourceSpace
Thanks for working on this David. I can confirm that the transform
plugin now works again in my Windows IIS 7.5 environment for resources
published via the upload tool and also via staticsync
($staticsync_ingest=true;).

However, for resources brought into RS via staticsync
($staticsync_ingest=false;) I get the following error when clicking
the transform link:

"C:\inetpub\wwwroot\resourcespace\plugins\transform\pages\crop.php
line 62: getimagesize(C:\inetpub\wwwroot\resourcespace\include/../
filestore/tmp/transform_plugin/pre_631.jpg): failed to open stream: No
such file or directory"

I know that with $staticsync_ingest=false; RS does not have direct
control over the original resources, so maybe this is to be expected.
Or, is the transform tool first suppose to copy the original resource
over to a temp area to do the transformation?

Thanks,
John

Jeff Harmon

unread,
May 4, 2010, 5:15:41 PM5/4/10
to ResourceSpace
i get the same exact error, Apache 2.2.14/OS X 10.5.8 server, PHP
5.2.9

- J

David Dwiggins

unread,
May 4, 2010, 5:35:29 PM5/4/10
to resour...@googlegroups.com
No, you're right, this is a different bug. It is supposed to create a
fresh preview of the original file in the temp directory, and this
must be failing for external images for some reason.

I am going to send you guys some test code directly -- if you can run
it, it will help narrow down where the problem is.

-David

njenney

unread,
May 4, 2010, 10:41:55 PM5/4/10
to ResourceSpace
David,

I retested my issue and it works great now after pulling down your
changes from SVN.

One minor cosmetic copy change.

Can you change...

When you are done, enter a name for the crop and press save.

to...

When you are done, enter a name for the crop and press download.

Thanks!

Jeff Harmon

unread,
May 5, 2010, 2:58:36 AM5/5/10
to ResourceSpace
i just tested for a couple hours, and it doesn't work great here on
some images. can others please test layered files, and/or files with
alpha channels? i suspect they always fail, and that this failure
predates r1852. i also suspect that in the creation of the tmp folder
we may not be setting permissions properly...? not sure about that
one.

- Jeff Harmon
Colorhythm LLC

Tech Patriot

unread,
May 5, 2010, 4:09:18 PM5/5/10
to ResourceSpace
Hi Jeff,

In my situation it turns out that I had been using multiple words in
my staticsync folder and/or file names that was causing the problem.
The transform tool was not able to locate the original file(s) in
those instances. If a folder and file was using a single word for a
name then there were no problems.

David committed rev 1860 that that fixed the problem for me.

njenney - the page copy now says "When you are done, enter a name for
the crop and press save or download." too.

Great work David!

Thanks,
John

Jeff Harmon

unread,
May 5, 2010, 4:22:23 PM5/5/10
to ResourceSpace
Hi John,

I suspect there is more than one bug operative here. Can you please
test some files with layers and/or alphas?

thx
Jeff

Tech Patriot

unread,
May 5, 2010, 5:00:21 PM5/5/10
to ResourceSpace
I can certainly do that. Just to be sure, would these be multi-
layered Photoshop files or some other format? If you can, email me an
example file and I can use that along with some others I'll generate
and do some testing.

Thanks,
John

David Dwiggins

unread,
May 5, 2010, 6:27:04 PM5/5/10
to resour...@googlegroups.com
Hi, Jeff,

You're right that there was more than one bug. I have not tackled the
channels/layers one yet. As John noted, if you could send me a sample
file that would make it quicker to test. I think that should be a
pretty quick fix as well.

-DD

Jeff Harmon

unread,
May 5, 2010, 8:44:52 PM5/5/10
to ResourceSpace
Multilayered TIFFs and PSDs both fail, AFAIK. i'm visiting my brother
in DC presently and can't easily get you sample files presently.

- Jeff

David Dwiggins

unread,
May 6, 2010, 12:23:05 AM5/6/10
to resour...@googlegroups.com
I created a simple multilayer tiff and psd in photoshop and used these
for testing. I was able to resolve this problem by having ImageMagick
flatten the images prior to doing the transform. Hopefully this is the
right behavior -- I think allowing transformations while still
preserving layers might be a bit trickier.

This is now in the trunk - give it a try and let me know your thoughts...

-David

CompuMatter

unread,
May 4, 2010, 8:16:21 PM5/4/10
to ResourceSpace
David,

Thanks for your contribution to the product.

I notice that the transform only effects the thumbnail and preview.

Are there plans to effect the original photo at some point. Gallery
viewers are still having to see the original unrotated image of
course. It would be a nice feature to effect the root resource image
by hecking a box or something.

Your thoughts?

Jay

Peter Romão

unread,
Nov 8, 2012, 6:51:07 AM11/8/12
to resour...@googlegroups.com
Hello there,

Is this problem resolved? I am having this problem with the latest release and this post is almost 2 years old.

Anyone?
Peter

Allison Stec

unread,
Nov 8, 2012, 7:44:39 AM11/8/12
to resour...@googlegroups.com
Here's a config setting that should help

# Normally, image tweaks are only applied to scr size and lower. 

# If using Magictouch, you may want tweaks like rotation to be applied to the larger images as well.
# This could require recreating previews to sync up the various image rotations.
$tweak_all_images=false;
$tweak_allow_gamma=true;

--
 
 

David Dwiggins

unread,
Nov 8, 2012, 8:08:12 AM11/8/12
to resour...@googlegroups.com
The tweak previews function and the transform plugin are two different things. Alison's solution might work, but it does not expose all of the functionality of the transform plugin. 

If you want transform to affect the original image, there is a setting for this in the plugin options page. 

Once you have enabled it, you will see a "transform original" option on the "edit resource" page. This will let you rotate, flip, or crop the original, and will also affect all of the previews. 

The original untransformed image will be saved as an alternative. (At some point I plan to make this behavior optional, but right now it is the default.)

Sent from my iPhone
--
 
 

Allison Stec

unread,
Nov 8, 2012, 8:16:29 AM11/8/12
to resour...@googlegroups.com
My mistake. Thanks for the clarification.

--
 
 

Reply all
Reply to author
Forward
0 new messages