forum.coppermine-gallery.net

Support => cpg1.5 plugins => cpg1.5.x Support => cpg1.5 plugin contributions => Topic started by: Timos-Welt on January 07, 2009, 12:48:53 am

Title: Thumb_Rotate plugin for cpg1.5.x
Post by: Timos-Welt on January 07, 2009, 12:48:53 am
What's this?
This plugin will rotate your thumbnails randomly, giving your gallery a 'comic' look.
Have a look at the attached screenshot to get an impression.
The plugin currently is an alpha version, so use with care!

Requirements
- a fast server
- additional space for the generated thumbnails
- PHP 4.3.2 or PHP 5
- PHP with working GD2 (ImageMagick will NOT work!)
  
Install
1. Unzip.
2. Upload folder thumb_rotate to the plugin folder of your gallery.
3. Install via plugin manager.

Demo gallery
http://cpgdev.timos-welt.de/cpg15x/
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: SaWey on January 07, 2009, 11:10:18 am
What about using something like this: http://www.swfir.com/ ?
Should be much less resource intensive.
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Timos-Welt on January 07, 2009, 12:25:08 pm
Good idea, but...

Quote
    * Resizing/zooming in Opera crashes the browser
    * Flash of unstyled content: images load first before JavaScript replaces them
    * alt text is not preserved upon replacement
    * HTML right-click options are disabled
    * Incompatible with other JS libraries like Prototype or MooTools
    * Doesn’t work with hot-linked images because of security restrictions in Flash

 ;)
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: SaWey on January 07, 2009, 12:30:24 pm
I wouldn't use their javascript but only the flash file, this should escape most of those problems
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Timos-Welt on January 07, 2009, 02:04:43 pm
Update to version 0.2.

Changes:
- possibility for image border
- better thumb quality
- a few code optimisations

@SaWey: Flashbased_Thumb_Rotate is a nice name for a new plugin, isn't it?  ;)
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Joachim Müller on March 21, 2009, 12:40:17 pm
Added to downloads section (http://downloads.sourceforge.net/coppermine/cpg1.5.x_plugin_thumb-rotate_v0.3.zip) and subversion repository (http://coppermine.svn.sourceforge.net/viewvc/coppermine/branches/cpg1.5.x/plugins/thumb_rotate/)
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Joachim Müller on April 27, 2009, 09:34:18 am
I had some time to kill and wanted to use the plugin for the gallery of a friend (http://sport-fun-reisen.de/index.php), so I went ahead and coded a config screen for the plugin (v0.3). I have edited my above download link and added the file to Timo's initial posting as well.

Joachim
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Timos-Welt on April 27, 2009, 02:50:15 pm
Absolutely great, Joachim! :) I love your version of the plugin, it's much more user-friendly, and the localisation is perfect in my eyes. I removed the old version from the first post, because there's no advantage in keeping it.

My GD isn't recognized as correct version (see screenshot of phpinfo), so your 'ignore wrong version' box was very useful when installing v0.3. I still simply wonder why anti-aliasing doesn't work at the bottom of the generated thumbnails; seems to me like a GD bug to be honest (it would make the images look a lot better).

best regards
Timo
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Timos-Welt on April 27, 2009, 09:41:40 pm
I've found the bug why anti-aliasing wasn't working at the bottom of the modified thumbs. Version 0.4 looks a lot nicer! :)
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Αndré on April 28, 2009, 11:14:08 am
I haven't tested your plugin and I don't know if these points are still needed in the new versions:
Install
1. Unzip.
2. Open codebase.php with a text editor and change values for $maxdegree, $themebackcolor, $border and $brdcolor.
3. Upload folder thumb_rotate to the plugin folder of your gallery.
4. Make subfolder thumb_cache writable, this usually means CHMOD to 755 or 777.
5. Install via plugin manager.
'2.' should be configured during plugin installation (and the values stored in the database).
'4.' this can be done during the plugin installation, too, or am I wrong?

If these 2 points will be changed, the plugin can be installed completely via the plugin manager without file modifications.
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Timos-Welt on April 28, 2009, 01:52:56 pm
Removed 2. from the initial posting. Not longer neccessary after Joachim's additions.
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Joachim Müller on April 28, 2009, 04:04:12 pm
Attached is version 0.5, which features some more functions. However, therer is no sanitization at all in the relevant file, so it could be abused for virtually any mischief. Don't use the plugin "live" - expect a new version soon to fix the security impact.

Changelog:
  0.4 to 0.5
    - removed image from plugin root that was added in error (resides in sub-folder "images")
    - improved version checking during install for GD version to avoid text in version string spoiling the result
    - changed cache path from folder within plugin path into sub-folder within edit folder, which should be writable out of the box
    - added display of amount of cached files
    - added option to empty cache
    - added farbtastic plugin (http://acko.net/dev/farbtastic)
    - added test to installer to check if cache folder is writable

Because of the impact of the security vulnerability I have temporarily disabled the plugin on the site I initially refered to as well to make sure nobody will attack it using the weakness. I recommend temporarily turning off the demo as well.

Joachim
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Joachim Müller on April 28, 2009, 04:56:16 pm
Sometimes it helps if you don't start hacking away, but stop and think for a moment. Here's what I've come up with - please don't take this as criticism, but as a discussion in an effort to play code pong.
There are two major flaws that this plugin has:
1) the fact that the URL parameters for the call to http://example.com/gallery_folder/plugins/thumb_rotate/thumb_rotate.php contain so much sensitive information including paths and filenames that are hard to sanitize and easy to tamper with.
2) All thumbnails get stored within one folder, which will be no drama for 100 files, but it will become a problem for 1,000 files or 10,000 files.

The fix for problem #1 is easy: there's no reason why we have to pass all that sensitive data in the URL - we just need the file thumb_rotate.php (where the actual image calculation happens) aware of the data coppermine already "knows", then we can use what we already have: the picture ID (pid). For that, we don't call the file like this any longer http://example.com/gallery_folder/plugins/thumb_rotate/thumb_rotate.php?img=albums/userpics/10001/thumb_flower.jpg&deg=348&bg=EFEFEF&brd=10&path=albums&brdcol=A2DB14, but like this http://example.com/gallery_folder/index.php?file=thumb_rotate/thumb_rotate&pid=123
All the parameters that we need already are known if you invoke coppermine. From that point on, you just need to accomplish that.

The second problem (with all files being stored in a silly manner inside the cache folder) isn't that hard to solve neither: if storing all those files within one folder causes so much trouble, then let's just not do that. So, where could we store the rotated thumbnail instead? Sure, within the folder in which the orginal thumbnail resides in as well. In fact, we do the very identical thing when using the watermarking mod - we store another copy of each file with another prefix. For this purpose, the prefixes "rotate_left_" and "rotate_right_" come to mind (as we need to store two copies after all). So what do we do now: we could create those two extra copies when the orginal file get's uploaded and maybe even alter the admin tools to come up with a mass-creation routine, but that would be beyond the scope of a plugin. So what then? Well, let's use the best out of both worlds and create the rotated thumbs on the fly (when they are needed), but keep them permanently. Basically, the lookup already exists in the code - it just needs to be edited to make it look into the proper folder.
Now on to the last issue: the cached copies of the rotated thumbs get obsolete if the user changes one of the options, so how could we handle that? In the existing code, you renamed all files, adding the possible parameters to the file name. This would make things nearly impossible to maintain, so this is where the database comes into play: let's add a column to the pictures table during plugin install. Into that field (for each image record), we'll just store a flag "rotated thumbnail exists" (true/false). Whenever a rotated copy was created, that database field is being updated. Whenever the config for the plugin is changed and all rotated thumbails become obsolete, you just run a query to empty the entire column.

So, this is all doable. The question is: who (if at all) is going to code this? Please give me your thoughts on my proposals.

Joachim
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Timos-Welt on April 28, 2009, 06:22:22 pm
Thanks for your thoughts, I'm thinking about a solution for all the issues.

Another security flaw:
The plugin config page can be called and settings can be changed by any user without logging into the gallery:
http://link_to_gallery/index.php?file=thumb_rotate/index

A problem of version 0.5:
The cache folder at albums/edit/thumb_rotate_cache doesn't work for me. Somehow the folder has been created with permissions that don't allow me to do anything with it (see attached screenshot of Filezilla). The script isn't allowed to put any files into it. I can't even delete the folder on the server via FTP or change its permissions, it's stuck forever now. :(

regards
Timo
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Αndré on April 28, 2009, 07:12:07 pm
The plugin config page can be called and settings can be changed by any user without logging into the gallery.
Just add
Code: [Select]
if (!GALLERY_ADMIN_MODE) cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);to the top of the file.

A problem of version 0.5:
The cache folder at albums/edit/thumb_rotate_cache doesn't work for me. Somehow the folder has been created with permissions that don't allow me to do anything with it (see attached screenshot of Filezilla). The script isn't allowed to put any files into it. I can't even delete the folder on the server via FTP or change its permissions, it's stuck forever now. :(
You have to delete this folder with a php script, because you don't have the permission to delete the folder via ftp.
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Timos-Welt on April 28, 2009, 07:28:20 pm
@eenemeenemuu:
Thanks for the tip; just deleting it via php wasn't enough, I had to change the permissions via php first:
Code: [Select]
chmod('thumb_rotate_cache',0777);
*mopping the sweat out of my face*   ;)
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Joachim Müller on April 29, 2009, 07:30:33 am
The use of this plugin is currently not secure. Please don't use it on any productive website!
Thanks for adding the warning. However, this sub-board currently isn't visible yet for the public, so there's little harm done. However, the cpg1.4.x-version of the plugin (http://forum.coppermine-gallery.net/index.php/topic,57469.0.html) is vulnerable as well, so you might want to review that as well. The good news is: the plugin flavors for cpg1.5.x and cpg1.4.x won't make a big difference, since there is no fancy regex-stuff going on in the sanitization (which might be a show-stopper for some plugins to be backported). So once we get this issue solved, we can easily address the same issue in cpg1.4.x and add the config section to it just as well.


*mopping the sweat out of my face*   ;)
Hehe, please review your config settings for Default mode for directories (http://coppermine.svn.sourceforge.net/viewvc/coppermine/trunk/cpg1.5.x/docs/en/configuration.htm#admin_picture_thumb_advanced_chmod_folder), because that's what is being used as mode toggle. I'll look this up in the core code to see how new folders are being created out of the box. I'll add that to v0.6 as well as the fix from eenemeenemuu regarding permissions (thanks!).
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Joachim Müller on April 29, 2009, 07:32:15 am
Talking about releases: Do you both feel that you're ready for SVN write access? That would make development of this plugin much easier.
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Αndré on April 29, 2009, 08:03:07 am
I'm not sure ;D
Everything I've done with svn yet is: checkout & commit without changes by other users in the meantime. I don't know which difficulties can occur, but I'm sure, that google knows the solution of occuring conflicts ;)
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Joachim Müller on April 29, 2009, 08:50:58 am
I'll look this up in the core code to see how new folders are being created out of the box.
OK, I have to apologize: the lines
Code: [Select]
    is_dir(dirname($CONFIG['fullpath'] . 'edit/thumb_rotate_cache/')) || mkdir_recursive(dirname($CONFIG['fullpath'] . 'edit/thumb_rotate_cache/'), $CONFIG['default_dir_mode']);
    $result = is_dir($CONFIG['fullpath'] . 'edit/thumb_rotate_cache/') || @mkdir($CONFIG['fullpath'] . 'edit/thumb_rotate_cache/', $CONFIG['default_dir_mode']);
should actually have been
Code: [Select]
    is_dir(dirname($CONFIG['fullpath'] . 'edit/thumb_rotate_cache/')) || mkdir_recursive(dirname($CONFIG['fullpath'] . 'edit/thumb_rotate_cache/'), octdec($CONFIG['default_dir_mode']));
    $result = is_dir($CONFIG['fullpath'] . 'edit/thumb_rotate_cache/') || @mkdir($CONFIG['fullpath'] . 'edit/thumb_rotate_cache/', octdec($CONFIG['default_dir_mode']));
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Timos-Welt on April 29, 2009, 09:42:41 am
I think a plugin like this would be a very good start to learn more about SVN, committing etc. ;)

I see you solved the issue that caused the strange folder permissions. $CONFIG['default_dir_mode'] was set correct in my 1.5 installation (0750), I had already checked that. But I never had done file and folder handling with PHP before, so I sat a few minutes in front of the two lines without finding the problem. (Then the phone ringed and a financial adviser wanted to tell me the usual lies that his offer was the best of them all).

I've added the unsecure announcement to the 1.4.x version, too.

regards
Timo
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Joachim Müller on April 29, 2009, 09:57:42 am
I think a plugin like this would be a very good start to learn more about SVN, committing etc. ;)
I agree.

@all interessted devs: Please register at sourceforge.net (if you haven't already done so) and let me know your sf.net user name, as I need that to add you to the list of devs with SVN write access. Please read up the details on how to access the SVN in the dev section of the cpg1.5.x docs.
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Joachim Müller on April 29, 2009, 10:06:08 pm
OK, thanks for the PMs with the Unix names - I have added SVN access for you. Remember to always check out before checking in.
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Timos-Welt on May 04, 2009, 01:44:21 am
Version 0.7 should be secure.
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Joachim Müller on May 04, 2009, 11:36:39 am
@Timo: Good work - I had a look at your commit - looks OK. Only one issue: please do always comment your SVN commits.
Sadly, both your efforts as well as mine have been simultaneous, while my changes are much more dramatic: in fact I did re-code quite a lot of the plugin, providing a fallback for the function imagerotate, moving the code from thumb_rotate.php into codebase (there was no need for that extra file, it just caused a lot of extra resources consumption, generating the rotated thumbnail twice. Now the plugin should be safe to use in terms of security. As both code changes happened simultaneously, only one can remain.
I have commit my changes and attached a packaged version, counting the version counter up to 1.0 to mark the re-write and subsequent change of the way the plugin works. Please take a look at the code improvals and the readme file.

@all: When updating the plugin, make sure to manually delete the cache from the old version - the files inside the edit folder are not needed any longer.

Because of the impact of the security vulnerability I have temporarily disabled the plugin on the site I initially refered to as well to make sure nobody will attack it using the weakness. I recommend temporarily turning off the demo as well.
I have re-enabled the plugin on the site I refered to initially. It's safe to re-enable your demo as well imo.

Cheers

Joachim
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Timos-Welt on May 04, 2009, 02:14:59 pm
Quote
please do always comment your SVN commits

I will, sorry.

Regarding your changes:

I think it's not a good idea to do the image calculation inside of codebase.php - in the end, it's very ressource intensive, and it's quite likely that people will get server error messages on large thumbnail pages with for example 4 colums and 20 rows, especially on slow servers and/or free hosting services. GD is much more CPU hungry than Imagemagick, at least on my server.
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Joachim Müller on May 04, 2009, 09:56:01 pm
But how is this suppossed to make a difference? The little overhead of coppermine's array definitions and database calls will not hurt in comparison to the resources comsumption of the GD image manipulation, so I can not see your point here to stick this into a separate file. To make it secure you'd have to apply the coppermine logic (db queries tec.) to the extra file as well, so what is gained? Maybe I'm not getting the concept you propose - could you please elaborate why you insist on two files?
Please take a look at the nifty cache creation that I have come up with - the cache will eventually grow as needed. Quite frankly, the method I have chosen is far less resources-consuming than the original, as you do heavy manipulation of the entire HTML output with regular expressions. You do that constantly, for all pages generated by coppermine - that's overkill. In the new version since 1.0, there's only a moderate str_replace going on on the thumbnail param array. Maybe someone can do benchmarks and compare the two versions to try to find out which version is less resources-hungry.

The image creation process in itself is not optimal yet and can be improved still to eat less resources, especially in memory consumption.

I have added most of the features in the version 1.1 that I have attached (is in the SVN as well). Please review.

Cheers

Joachim
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Timos-Welt on May 05, 2009, 08:23:33 am
But how is this suppossed to make a difference? The little overhead of coppermine's array definitions and database calls will not hurt in comparison to the resources comsumption of the GD image manipulation, so I can not see your point here to stick this into a separate file. To make it secure you'd have to apply the coppermine logic (db queries tec.) to the extra file as well, so what is gained? Maybe I'm not getting the concept you propose - could you please elaborate why you insist on two files?

Most webhosts I know of limit the php script duration time that a server will execute, the CPU time of a script as well as the memory consumption. If you exceed these limits, the server will time out with a blank page or deliver an error message. If you execute the graphic creation as a seperate php script, every single call has the full ressources on its own. If you do it inside of the CPG script, all thumbs together will have to share the server limits, so it's quite likely that a server time out will appear on slow or restrictive configured web servers.

Let's assume a thumbnail page is called with 4 columns and 20 rows, that's 80 thumbnails. And let's assume that it's the first call of this page, so all thumbs have to be created on the fly. That's 80 files of input with 3-5 Kbyte, and 80 transparent rotated thumbs as output with 22-24 Kbyte, together 3,2 MB of files that have to be touched. Each new thumb is created in five steps (create new bigger empty picture, make transparent, create border inside it, paste existing thumb in the middle, rotate it) that are CPU intensive. Cheap (http://www.df.eu/germany/produkte/myhome/myhome-dynamic.html) or free web hosts will limit the CPU time a script may use to 2-10 seconds. IMO this alltogether smells like time out.  ;)

I really like your codebase.php, it is very well done and much more clever than mine. What I miss is the correct width and height of the generated thumbnails; while the previous versions ignored these info completely, now the thumbs are presented scaled down to the size of the source thumbnail, which looks ugly and/or unsharp in some browsers. If you adhere to the thumb creation inside of codebase.php, I propose that <tt>thumb_rotate_image_create($CURRENT_PIC_DATA)</tt> should return as well the width and height of the generated thumb so we may save these information to the new table as well and use them when displaying the new thumbs.

regards
Timo
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Joachim Müller on May 06, 2009, 08:12:32 am
Let's assume a thumbnail page is called with 4 columns and 20 rows, that's 80 thumbnails.
And that's the reason why this is wrong imo. Part of the concept: this plugin is a resource hog. People on servers with limited resources should not display 80 thumbnails on one page anyway. They should not use this script neither. Yes, this script can bring down your page, but you will notice as well. I'll look into a workaround for those one small resources as well - it will probably help to provide admin tools as well that do not only delete the cache, but a tool that builds the cache in the first place, but slowly.
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Hein Traag on May 06, 2009, 08:56:17 am
Goodmorning!

Tried the plugin on my testbed. Albums folder and all child folders set to 777. And it does make the rotate_** files but it does not display the images.

Any idea what might be wrong here?

Cheers
Hein
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Timos-Welt on May 06, 2009, 04:48:23 pm
Hein, which version of the plugin are you trying? 0.7? 1.0? 1.1? The current SVN? I tried out 0.7 and 1.1, both work well here.

regards
Timo
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Hein Traag on May 07, 2009, 07:58:34 am
I am using 1.1 but i think it has something to do with rights. It does make the new rotate files with borders but without the actual thumb inside it. I'll do some more testing and probing..
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Joachim Müller on May 07, 2009, 10:40:58 am
@Hein: is your testbed publicly accessible, so we can have a look?

@all: I have added some more features and updated the SVN files accordingly. A new package with (version 1.2) is attached. To upgrade the plugin, please uninstall the plugin (using the plugin manager) and then re-install to make sure the database changes have an impact.

In version 1.2 I'm trying to cover some of the issues that Timo has brought up. Trying to solve Timo's concerns about resources consumption on "weaker" servers I have added two options to the config: one allows to make the plugin admin-only to allow the admin to build the cache in advance for a larger site and only after having built the cache finally turn the admin-only toggle off to let visitors access the rotated thumbnails. The other option allows you to specifiy a delay period between each time a rotated image is created. For this, the script will return the unrotated thumbnail if it has created a rotated thumbnail within the past XX seconds (where XX is the period you specify for the delay). The delay will as well be taken into account for the batch-fill screen that I have come up with: this screen will allow the admin to batch-create the rotated thumbnails without the need to click through the entire gallery thumbnail pages.
Please test thoroughly and post your feedback.

Joachim

P.S. I have started to work on an unfinished option that allows you to create thumbs with rounded corners as well. That option currently will only show on the config screen, but it can not be selected yet.
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Hein Traag on May 07, 2009, 11:38:51 am
Sure, it's at cpg15.rondvierkant.nl

I installed the 1.2 version and now it does show the regular thumbnails and when i check the ftp album folder it does have rotate files.. I'm guessing it's a rights issue but have not figured out what it might be yet.
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Timos-Welt on May 07, 2009, 12:25:39 pm
@Hein:
I can reproduce your issue when I install other plugins at the same time (e. g. EnlargeIt! v0.3) and play with the plugin order. Seems to me like thumb manipulation conflicts. But I still have no idea why it happens.

@Joachim:
I like the idea of rounded borders, a shadow would be nice as well. I already tried to code this, but it would require alpha transparency in the png files, and different php/gd versions handle this quite different, and some browsers (the terrible IE6 for example) cannot display them anyways, so I dropped the idea.

What's still missing is the correct sizes of the manipulated thumbs; ATM, they have the size of the original ones and are displayed scaled down. thumb_rotate_image_create should return the sizes of the generated thumb, so it can be saved to the plugin table together with the thumb name:

Code: [Select]
function thumb_rotate_image_create($CURRENT_PIC_DATA) {
...
...
...
// rotate image
$rotate = imagerotate($finalimg, $degrees, $fin_bg);
$finalsizex = imagesx($rotate);
$finalsizey = imagesy($rotate);

// set transparency
imagecolortransparent($rotate, $fin_bg);

// deliver png and save to cache
$result = imagepng($rotate, $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CONFIG['plugin_thumb_rotate_thumb_pfx'] . $CURRENT_PIC_DATA['filename_without_extension'] . '.png');
if ($result) {
$return = array($CURRENT_PIC_DATA['filepath'] . $CONFIG['plugin_thumb_rotate_thumb_pfx'] . $CURRENT_PIC_DATA['filename_without_extension'] . '.png', $finalsizex, $finalsizey);
} else {
$return = '';
}
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Hein Traag on May 07, 2009, 12:37:38 pm
@Timos
I deinstalled all the other plugins but no luck yet. It stil only creates the empty rotate pictures. I'll upgrade first to the latest build op 1.5 and go from scratch.
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Joachim Müller on May 07, 2009, 12:44:05 pm
@Hein: do you actually have the function imagerotate available or does the plugin fall back to the surrogate it comes with?

@Timo: thanks for your input - I'll look into it.

Regarding IE's lack of support for PNG transparency: that's why I toyed with the idea to completely rely on the config option for the background color and create jpg files in the first place, as an alternative.

Joachim
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Hein Traag on May 07, 2009, 12:54:36 pm
The function imagerotate is not avaible to me. So the plugin seems to fallback to the surrogate.
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Joachim Müller on May 07, 2009, 12:56:38 pm
That's probably the reason - I haven't been able to make the surrogate work as expected on every setup.
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Hein Traag on May 07, 2009, 02:00:19 pm
Okay so should that be mentioned somewhere that it works better if that function is avaible? Or does that not matter once the surrogate is functioning as it should?

Either way i do like this little plugin a lot. Although it eats up space it stil adds a bit of extra to the look of a site. Nice work guys!
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Timos-Welt on May 07, 2009, 03:36:45 pm
that's why I toyed with the idea to completely rely on the config option for the background color and create jpg files in the first place, as an alternative.

JPG files will not work for themes (http://coppermine-gallery.net/demo/cpg14x/thumbnails.php?album=31&thumbnails_php?album=31&theme=connections) with (http://coppermine-gallery.net/demo/cpg14x/thumbnails.php?album=31&thumbnails_php?album=31&theme=coppersheet) a thumb background (http://coppermine-gallery.net/demo/cpg14x/thumbnails.php?album=31&thumbnails_php?album=31&theme=fiapple) that is not a solid color (http://coppermine-gallery.net/demo/cpg14x/thumbnails.php?album=31&thumbnails_php?album=31&theme=grey-style-20). It could be an option, but should not be the usual way the plugin works.
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Joachim Müller on May 07, 2009, 10:25:37 pm
I agree, PNG is the file format of choice, only with a fallback option for jpg.
However, the idea to make the function thumb_rotate_image_create return the dimensions is not a bright idea as long as we don't store the dimensions somewhere. We'd have to keep that in the database. I'm not sure though if it wouldn't be wiser to just use getimagesize each time (on the fly).

@Hein: afaik there should be a warning when you install if you don't have the minimum requirements. Didn't you see a warning when you installed the plugin?
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Timos-Welt on May 08, 2009, 10:46:33 am
Hi Joachim,

getimagesize() should be much slower than storing width and height into the database - we have to query it anyways for each thumb.

I agree with Hein - I really like this plugin, too. Especially because it is something that is currently not available for any other web gallery product that doesn't use flash; it makes Coppermine even more unique. Joachim's work regarding the config screen and the technical realization is extremely well done (compared to mine).

More feature ideas for this plugin:
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Hein Traag on May 10, 2009, 09:51:10 pm
@Joachim. No there is no warning if this function is not present. There are only messages saying your apache and php version are ok.

No in-depth check so to speak.
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Hein Traag on May 11, 2009, 12:47:49 pm
Reinstalled cpg to the latest build and reinstalled the 1.2 version. It now works except for the background which remain black even when you choose white. I'll play around some more to see if i can make that work.

The rotated thumbs i get do not look like the image in the starting post.
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Joachim Müller on May 11, 2009, 09:09:12 pm
It now works except for the background which remain black even when you choose white.
Happens for me as well. Reason is the imagerotate surrogate that doesn't work as expected.

Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Timos-Welt on May 18, 2009, 02:06:08 pm
I just checked out the latest SVN version (2.2) and installed it, and it's really awesome. Joachim: I don't think there's anything left from my initial code - if you like you can remove my name from the files completely. All the kudos belong to you!
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Hein Traag on May 18, 2009, 03:47:29 pm
Original author always gets mentioned Timos. Without your effort this plugin would not exist.

But i also downloaded 2.2 and it installs without error, even displays a nice warning about the "imagerotate" function. But when i click the batch-fill cache it links to batch-fill instead of batch-fill.php. And when i click on Home it displays a blank page. Is this something anyone can verify?
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Joachim Müller on May 18, 2009, 07:12:50 pm
I can confirm your observation on one of my testbeds. Seems like I'm causing too much memory consumption. I'll investigate and keep you updated.
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Timos-Welt on December 11, 2009, 02:07:03 pm
Any news about the current state of this plugin? AFAIK the workaround for missing GD functionality doesn't seem to work. Rounded borders look a bit ugly to me. I found a nice GPL product that could be really useful together with the plugin and would solve the graphic lib problems:

http://phpthumb.sourceforge.net/
Title: Re: Thumb_Rotate plugin for cpg1.5.x
Post by: Joachim Müller on December 11, 2009, 05:35:21 pm
Looks promising