add new aspect ratio for "edit thumbnail" java app

steidlf

Joined: 2004-09-06
Posts: 56
Posted: Tue, 2005-07-12 12:56

Hi, all,

I updated my gallery to 1.5 and did some redesign.

To fit the thumbs into my design I'll need an aspect ratio of 83 (half a picture of 43). I had a look into edit_thumb.php and into java/ImageTools.jar, but did not find a plaintext area to add one new aspect ratio.

Is there any way to do this by my own or where could I order a new compiled file? (what are .jar files?)

Thanks for any hint.

Greetings
Frank

 
fryfrog

Joined: 2002-10-30
Posts: 3236
Posted: Tue, 2005-07-12 13:15

You might take a look at the thumbnail cropping tool, and jar files are java files that are compressed in either zip or tar format I think. It'd be a little akward to change the aspect ratio of a thumb arbitrarily. You'd have to crop some portion of it. So do you crop the top, bottom, equal portions of both, some amount of both? Its not a simple change you want.

You might consider looking at G2 and its square thumbs module which I have been *told* should be pretty easy to modify to support what ever ratio you wanted.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Tue, 2005-07-12 13:32

Gallery makes the thumbs by taking the longest side and then adjusting to that. So that portrait and landscape items are done properly. If you photos are not uploaded with the aspect ratio you want then there is a couple of ways to do it.

Edit the photos before you upload them to the aspect ratio you want. There is other software (some free) to do this in bulk.

Edit the Java:
'''JAR''' == '''J'''ava '''AR'''chive.
" package format that Java applications / applets are often distributed in."

I am no expert on that sorry I can't help.

Dave

 
steidlf

Joined: 2004-09-06
Posts: 56
Posted: Tue, 2005-07-12 13:47

fryfrog, thanks for your answer.

I have to apologize for not being clear enough...
Just to be sure this time...

fryfrog wrote:
You might take a look at the thumbnail cropping tool

when logged in (and owner of this albums and picture) i'll find a dropdownlist with the item "edit thumbnail" (not quite sure, I am using german language pack). When selecting this, a popup window appears with a java applet which lets me choose the aspect ratio of the green border and I can decide where to place this green border to select my thumbail. Did you mean this tool?

Under the picture with the green thumbnail-select-frame there's a dropdown list with several ratio presets (xxx:yyy as image, 1:3 Letterbox, ...)
Now I want this dropdown list be extended with a new aspect ratio of 8:3

I could imagine that setting this green frame in a special ratio should not be a problem, because all we need to crop the image are x and y coordinates and width and height...

Yes, I had a look on G2 but unfortunately my provider gives me too less ressources, from the first step on I experienced problems... Therefore I did an update from 1.44 to 1.5

Frank

 
fryfrog

Joined: 2002-10-30
Posts: 3236
Posted: Tue, 2005-07-12 14:04

Ah, I see what you mean now. It should be possible to do that much easier than I thought. I would start with figuring out how to open a jar file, probably just right clicking on it and choosing "open with" and then choosing your favorite archive program like winzip, power archiver or winrar. Now you'll need to find the source that involves the ratios... so I'd simply search all those files for a phrase that is in the drop down list. If "Letterbox" is a phrase in the list, that'd probably be a good thing to search for. Then I'd copy the format used and include your new ratio :)

 
steidlf

Joined: 2004-09-06
Posts: 56
Posted: Tue, 2005-07-12 15:24

Hi, fryfrog,

fryfrog wrote:
Ah, I see what you mean now. It should be possible to do that much easier than I thought. I would start with figuring out how to open a jar file, probably just right clicking on it and choosing "open with" and then choosing your favorite archive program like winzip, power archiver or winrar.

Ok, so far I am with you. I was able to open the archive with winzip and extract the class files.

fryfrog wrote:
Now you'll need to find the source that involves the ratios... so I'd simply search all those files for a phrase that is in the drop down list. If "Letterbox" is a phrase in the list, that'd probably be a good thing to search for.

I was even able to search for "Letterbox" and got the file ImageCrop.class. But it seems this file is a kind of binary data, neither vi nor notepad/wordpad show a kind of programming language code.

Here ends my knowlegde about Java programming. I've heard the class files are compiled code used by the JavaRuntimeEnvironment. And I guess I'll need the source code to apply my changed and an SDK to recompile and repack the files into a new ImageTools.jar

Is it possible to get in contact with the author of this java software?

Thanks in advance...

Frank

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Tue, 2005-07-12 22:11
steidlf wrote:
Is it possible to get in contact with the author of this java software?

Try in the Gallery Remote forum. You might get better Java help there. I would like to have a education on this as well so I will follow your thread.

Dave

 
fryfrog

Joined: 2002-10-30
Posts: 3236
Posted: Wed, 2005-07-13 04:08

I don't know a thing about it either :)

 
steidlf

Joined: 2004-09-06
Posts: 56
Posted: Wed, 2005-07-13 11:13

Dave, fryfrog,

Thank you for your support. I placed a post in the Gallery Remote forum:
http://gallery.menalto.com/index.php?name=PNphpBB2&file=viewtopic&p=152263#152263

Let's see if someone can help me...

If you want to have a look on my gallery, go to:
http://gallery-1.5.fra.nksteidl.de
This version is not yet publically linked, because I'd like to have my 8:3 thumbs.
But if you could have a look on that and give me some feedback...

Thanks guys.
Frank

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Wed, 2005-07-13 13:29

steidlf,
Looks very nice.... One thing I would do is drop the page numbers on the top of albums.php but keep them for the others.

Dave

 
steidlf

Joined: 2004-09-06
Posts: 56
Posted: Wed, 2005-07-20 12:50

hmm.

it seems more difficult as I thought... OK, I'll try another way.

I learned PHP in order to extend Gallery in function and design.
Why not learning Java to extend the applet?

I assume, this java applet we are talking about, is also published under the GPL. I hope, there's the source code available. Could you give me a hint where to look for?

Thanks in advance.

Frank

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Wed, 2005-07-20 21:55
 
steidlf

Joined: 2004-09-06
Posts: 56
Posted: Thu, 2005-07-21 15:21

Hi, there,

now I did it on my own...

Thanks for the CVS Link, I downloaded the java source code and added my extension (it is commented how to do this).

Afterwards I installed the Java SDK, compiled the java file and jar'ed the classes to the new .jar file. At this point I realized that the filenames need to be the same as the name of the class.

I don't know exactly, why the IE JVM does only show a grey field and the Sun JRE works wihtout any message, but I'll ask some collegues.

Thanks for your help here.

Greetings
Frank