dont keep Original Picture

Zim

Joined: 2003-09-13
Posts: 8
Posted: Sat, 2003-09-13 18:03

I also have the need to NOT keep the original pics... my thoughts, algorithmically, were

- upload original picture
- do the resize for mid-size and thumbnail-size
- copy EXIF data to mid-size (adds what, 4-5k?)
- delete original
- create link to mid-size with original pic file name

I'm new to PHP, but then again, 5 years ago I was new to Perl, and now I'm writing 2000+ line scripts in that, so I guess it'll be a learning experience. Then again (worst case from an integration point of view), it could be a php system call out to a Perl script that does the cleanup after each pic is processed inside Gallery.

OR...

- upload original pic
- copy EXIF info
- resize original pic to mid-size
- overwrite original with mid-size... re-write the EXIF info to it,
- allow normal operations to go from there (or will I end up
with a non-resized duplicate mid-size?

Still if you see an fundamental flaw in my approach, please let me know.

Thanks,
Mike

 
loxly

Joined: 2003-01-28
Posts: 126
Posted: Sun, 2003-09-14 07:56
beckett wrote:
I have no idea. Wanna be my guinea pig and test it out??
I don't have time right now to check it out.

It was certainly working with the CVS version a couple weeks ago when I added some new photos to my own website.

Once 1.4 final is released, I'll have time to look into it if the code needs to be updated.

-Beckett (

)

I'm willing to be a guinea pig and test it with 1.4.1 if someone can email me the code and instructions :) I just read the whole thread and am not sure what goes where or how....

Debbie

 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3474
Posted: Sun, 2003-09-14 08:39

Well, my resize script is at http://www.beckettmw.com/testgallery/ , and I've since tested and it works with all current versions of Gallery just fine still.

However, my script works for resizing photos *after* they've been uploaded. If you want to resize *on upload*, either read this thread, and apply killerblade's patch (and optionally the EXIF code I mentioned afterwards) to util.php, *or*, you can wait for v1.4.1 which will implement roughly the same thing as killerblade's code.

-Beckett (

)

 
loxly

Joined: 2003-01-28
Posts: 126
Posted: Sun, 2003-09-14 08:48

I can wait :) Thanks for incorporating this feature into base code, since limited disk space is a big issue for many and I am looking for a way to be lazy and not resize with photoshop prior to uploading :) Will gallery remote work with the resize feature that will be in 1.4.1?

 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3474
Posted: Sun, 2003-09-14 09:03

[Gallery Remote]

Yes... except rather this code goes in "after" Gallery Remote. Gallery Remote, like a regular user, will submit arbitrarily-sized photos, which will then be "forced" down either to a maximum dimension, maximum filesize, or both. I *just* this second mentioned your question to Pierre, the Gallery Remote developer, so he's aware of it, and one way or another GR will work. ;)

-Beckett (

)

 
loxly

Joined: 2003-01-28
Posts: 126
Posted: Sun, 2003-09-14 17:33

Cool, sounds perfect. I have about 10,000 photos to upload, so I want to make it as efficient as possible.

Debbie
http://cool-networks.net

 
moritz69

Joined: 2003-07-30
Posts: 8
Posted: Mon, 2003-09-15 12:43

thanks again killerblade for your hack!
but on the one hand it makes things much easier (no photoshop is needed anymore for resizing images) and on the other things are more complicated now (gallery remote doesn´t works with the hack).

so beckett spoke with the GR developer. but when will there be a new version of GR with this cool hack implemented?

greetings

 
loxly

Joined: 2003-01-28
Posts: 126
Posted: Mon, 2003-09-15 17:13

Patience is a virtue :)

 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3474
Posted: Mon, 2003-09-15 22:49

Hunh? My point was that, properly implemented, GR will work just fine with the killerblade hack. I was just stating that currently, GR only resizes *optionally* and doesn't yet support resizing on the GR end by reading the "force resizing" option (which hasn't been implemented yet).

-Beckett (

)

 
moritz69

Joined: 2003-07-30
Posts: 8
Posted: Tue, 2003-09-16 21:54

ok sorry, then i understood something wrong...
when i upload pictures via html ("add photos" button in the admin mode) everything goes like i expect to. i just select the maximum of ten pics and then say upload. the pictures are after upload process in the size i want them to be. thumbnail and 800x600 and no original.
but when i upload pictures via gallery remote 1.1 they are in the original size and there is no intermediate (of course not, because i switched them off in the config wizard). in the gallery remote preferences you can say : album defaults or "force resize to". when i put it to defaults the size is smaller than 800x600. i think its 640x480.
and when i say force to 800x600 then its ok. but when the pic is 600x800 and not 800x600 gallery takes the default again and makes the pic to small.
so i still have to upload by hand.
another question: where must be the directory to put pictures via ftp in? and then import them to the gallery?
thanks in advance
and good night (from germany)

 
tomsawyer123
tomsawyer123's picture

Joined: 2002-07-24
Posts: 81
Posted: Wed, 2003-09-17 09:37
killerblade wrote:
hi folks!

after hrs of researching the code i DID it!!

u have to add the following code after line #329 (before the line: $err = $gallery->album->addPhoto($file, $tag, $mangledFilename, $caption);) :

kb

Your hack seem to be great but i didn't find the line above! In which file sould I finf it?
Does it work with all the gallery release? I am currently using Gallery 1.3.4.
Tks for your reply.

Tomsawyer

 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3474
Posted: Thu, 2003-09-25 07:40

::moritz69::

Hrm. It's possible it's not working right w/GR. I'm adding what's essentially killerblade's code to v1.4.1 and we'll make sure that it works with GR for that.

As for FTP, it just means you can upload your photos *anywhere* to your webserver, then provide the full path to that directory. The "FTP" is just used to transfer the files to your webserver. But you can get them there whatever way you like.

::tomsawyer123::

The code has moved since killerblade's original post. No longer in save_photos.php it's now in the processNewImage() function in util.php.

-Beckett

 
tomsawyer123
tomsawyer123's picture

Joined: 2002-07-24
Posts: 81
Posted: Thu, 2003-09-25 08:39

tks for your help. I manage to add the code.

cu

tom

 
porkozone

Joined: 2003-09-25
Posts: 11
Posted: Thu, 2003-09-25 23:07

Any idea on how soon v1.4.1 will be released? No rush, mind you...

I just don't see a need to add this code in if it's going to be "officially" done too soon. I am just now setting up my gallery, so am wondering if I should just hang tight and wait until 1.4.1 to start uploading photos...

While I'm inquiring, is there a tenative date for the release of G2? Again, no rush, just trying to figure out how soon to start building my family photo gallery!

 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3474
Posted: Fri, 2003-09-26 03:57

1.4.1

Soon-ish, but my guess would be within a month.

G2

There's no official schedule for G2. We're making *incredible* progress, but we're not going to give any hints at a date quite yet. My advice is not to depend on G2 anytime very soon, but anything could happen. ;)

-Beckett (

)

 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3474
Posted: Tue, 2003-09-30 06:39

OKAY!! (big grin on my face) :)

Auto-resize on upload is now available as of Gallery v1.4.1-cvs-b112. So read up FAQ A.2, and give it a shot, if you don't want to wait for the 1.4.1 release.

The changed code is loosely based on the original code from killerblade.

This code will *not* affect images that are already in your gallery, so if you still need to resize images after the fact, you'll have to either grab my myresize code, or wait a bit longer. I'm planning on adding support to resize originals in the [resize] button for each album.

-Beckett (

)

 
Grinch

Joined: 2002-08-28
Posts: 24
Posted: Wed, 2003-10-01 05:49

This is a great little piece of code, but it doesn't do one important thing. If the picture being resized is already the correct size to begin with, it should still adjust the photo quality to match the configuration settings. For example:

Original photo: 640x480 = 240kb
Resize photo: 640x480@60%Qlty = 80kb (or whatever)

Right now it just leaves the original file as is. Would this be possible to add in?

 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3474
Posted: Wed, 2003-10-01 08:28

Actually, it does do that. Or if not, please post the output of the image add with debug mode on. (I tested this about 100 times this week, so I'm 95% sure this should be working).

Remember, right now this code only affects new images that you upload. Also, the filesize compression only applies to JPEG and PNG images.

At some point, I'll add "resize original" features to the [resize] button so that existing original images can be resized.

-Beckett (

)

 
Grinch

Joined: 2002-08-28
Posts: 24
Posted: Wed, 2003-10-01 22:14

Thanks for the quick reply. I'm using version 1.3.4-pl1. Does that change anything?

How do I turn debug mod on?

 
BorgKing
BorgKing's picture

Joined: 2002-09-12
Posts: 314
Posted: Thu, 2003-10-02 12:54

beckett was talking about Gallery v1.4.1-cvs-b112.
1.3.4-p1 does not have the code you mentioned (I think).

 
Grinch

Joined: 2002-08-28
Posts: 24
Posted: Thu, 2003-10-02 23:24

Well I am stuck using 1.3.4-pl1 because I'm using the Snail Source phpBB integration mod. I heard that Gallery will soon offer integration with phpbb, so I guess I'm going to have to wait.

 
PressureDrop

Joined: 2003-10-07
Posts: 6
Posted: Tue, 2003-10-07 06:24

The MyResize code is a lifesaver =) I have 'unmetered' HD and Bandwidth on my server but I have a soft limit of 125 megs, this took me from 170megs down to 105megs (I still kept the originals pretty large) anyways I cant wait for a phpbb integrated gallery with the resize on upload and ditch original all built in to start with

-Zac-

 
latzke

Joined: 2003-09-30
Posts: 6
Posted: Tue, 2003-10-07 17:34

Beckett, this is some great stuff, thanks a ton for the feature. I do, however, have a question after reading this post...

beckett wrote:
If you download my myresize code (mentioned above), then enter an absurdly large number into the max. size box (say, 20000 pixels), and put the same number (or higher) into the ".sized" size box, then it will go through and remove all of the .sized images without touching your originals.
(It will then update the resize size to this value so that your future uploads will not generate the .sized images...).

Say I've downsized all the "original" pictures to 800x600 using your code, but later want to go back to having 2048x1536 "originals." ... Would I be able to do that by FTPing the full-sized pictures, with the exact same names, into the appropriate album folder, then doing what you describe in your quote?

I guess I'm just wondering if your resize program will take a look at the original photo, realize it is larger than Gallery thinks the original photo is (cause I've replaced it), and have this result in pages that account for the increase in size of the "original" photo?

(Yes, I know I could just re-add the album and delete it, but that would kill descriptions, captions, etc).

Thanks,
Craig Latzke
Fort Collins, CO

 
latzke

Joined: 2003-09-30
Posts: 6
Posted: Wed, 2003-10-08 07:30
latzke wrote:
I guess I'm just wondering if your resize program will take a look at the original photo, realize it is larger than Gallery thinks the original photo is (cause I've replaced it), and have this result in pages that account for the increase in size of the "original" photo?

Tried this - answer is no. Consider this a feature request.

I undestand this could slow down the processing, so maybe there would be a checkbox called "verify picture properties are correct" someone can click when they're doing this.

Still a very useful mod (and I was able to get the above to work by FTPing the old, before resizing, .dat and .bat files into the album directory when I FTPed the old original photos there as well).

- Craig

 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3474
Posted: Sat, 2003-10-11 12:30

Okay... feature requests you can submit to the RFE at SF.net.

*DO NOT* just upload new images to replace old ones. Gallery needs to know exact dimensions etc. You can up the value for *future* photos in that album, but don't ever ever do anything directly to anything in the albums directory. Consider it entirely "off limits". :)

Your idea sounds possible. BTW I'm planning on integrating the "myresize" stuff into v1.4.2 (already integrated the "resize on upload" stuff for 1.4.1).

Oh... i recently found a potentially bad bug in my myresize code! I'll plan on fixing it very very soon. Basically... if you have any thumbnails where you've edited the thumbnail (to focus in on a particular area), and then resize the thumbs, but have already resized the originals using my code, the thumbs will either regenerate incorrectly for those images, or not generate at all. I need to edit the resizing code to update the "thumb region" data. Plan to do that soon. (Follow along in SF.net Bug #821073)

-Beckett (

)

 
obere

Joined: 2003-10-12
Posts: 14
Posted: Sun, 2003-10-12 00:06

I've read this whole thread and am pleased to see this feature added in 1.4 so I won't try to hack my working Gallery 1.4 now. From my tests it looks like "resize on upload" still saves the original pic. Can I prevent this from being saved or have it auto deleted?

 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3474
Posted: Sun, 2003-10-12 07:31

Er the point of "resize on upload" is that the original photo is resized. If you set the intermediate "sized" dimension to be the same as the resize-on-upload dimension, then only one file will be added (plus the thumb), which I think is what you want.

-Beckett (

)

 
PressureDrop

Joined: 2003-10-07
Posts: 6
Posted: Mon, 2003-10-13 00:29
Grinch wrote:
...I heard that Gallery will soon offer integration with phpbb....

do any of the CVS version already do this? I suppose its a given that G2 will?

 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3474
Posted: Mon, 2003-10-13 07:05

phpBB2 integration is slated for v1.4.2. However, it could be committed to the codebase within the next 2 weeks.

-Beckett (

)

 
latzke

Joined: 2003-09-30
Posts: 6
Posted: Tue, 2003-10-14 17:33
beckett wrote:
Yeah. NetPBM and Jhead operations take forever. So the script is about as fast as it can be. If you use ImageMagick, it'll probably be a little faster.
I really should put something in the readme about doing resizes in smaller batches to avoid the timeouts (which are safe, but just a hassle because you have to restart again).

I am hitting the timeout (using ImageMagick) after a hundred or so images are resized. I try again, another 50 get resized. Try again, another 20. Try again, another 10. Etc. I'm at the point where I'm trying to resize one album (300-some pictures) and the timeout occurs before any pictures are resized (timeout period if consumed just checking already-resized pictures to see if they need resizing).

This is one of my largest albums - I expect I'll run into issues with 5 other albums I have that are 250-500 pictures large.

How can I make the timeout longer? Is there a parameter/variable, etc that determines/controls the timeout period? I've found nothing looking around the code or this forum, but I can't see why this wouldn't just be a variable set somewhere that I can change (and that "somewhere" is stumping me).

I'm sure the timeout is set where it is for a reason, but I can't imagine there would be harm in changing it temporarily to resize the larger albums, and then setting it back to the default.

Thanks,
Craig Latzke

 
fritternyt

Joined: 2003-09-24
Posts: 14
Posted: Wed, 2003-10-15 13:20

I am no programmer, but......
Would it not be possible to do the resizing as the very first thing.
A sort of front end where you could set your preferences for size of imported images. Then you would not have to alter the rest.
Jan

 
joan
joan's picture

Joined: 2002-10-21
Posts: 3473
Posted: Wed, 2003-10-15 13:59
fritternyt wrote:
I am no programmer, but......
Would it not be possible to do the resizing as the very first thing.
A sort of front end where you could set your preferences for size of imported images. Then you would not have to alter the rest.
Jan

Sure, and that will be in 1.4.1, and what killerblades fix does already.

But once you've uploaded the files, you need a way of reducing them.

 
obere

Joined: 2003-10-12
Posts: 14
Posted: Sat, 2003-10-18 01:23

I'm sorry to bother you on this issue again, but in the following, where do you make the setting for "resize on upload." I can find "Resized image size" which mentions "When large images are added to an album, an intermediary version will automatically be generated at this size" but where do I create a setting for "resize on upload" to match what you said in the below.

I have the "Resized Image Size" set to 600 in the Configuration Setup, but there is still a 1600 original file on the system which shows when clicking the 600px image on screen. I am using "v1.4-pl1"

Thanks a lot. I really appreciate it.

beckett wrote:
Er the point of "resize on upload" is that the original photo is resized. If you set the intermediate "sized" dimension to be the same as the resize-on-upload dimension, then only one file will be added (plus the thumb), which I think is what you want.

-Beckett (

)

 
goaweb

Joined: 2003-10-17
Posts: 30
Posted: Sat, 2003-10-18 02:55

Hi everybody ! ;)

I'm too lazy to read all the thread... But, my workaround is to use the Option:

Options > Preferences > Upload > Resize before upload > Album default on Gallery Remote 1.1 . :)

With that option I save a lot of space !

Bye !
Goaweb ;)

 
latzke

Joined: 2003-09-30
Posts: 6
Posted: Wed, 2003-10-22 18:21

How do I change the timeout?

(Look up 5 posts if you don't know what I'm talking about).

Thanks,
Craig

 
joan
joan's picture

Joined: 2002-10-21
Posts: 3473
Posted: Thu, 2003-10-23 11:04

Rerun config. wizard or edit config.php

 
2fargon

Joined: 2003-10-25
Posts: 7
Posted: Thu, 2003-11-20 23:12

I had myresize.php and myresize_funcs.php saved to the gallery folder, and the files in the images folder saved to images folder.

Now, when I try to run myresize by doing
http://2fargon.com/gallery/myresize.php ,

I get a Error 500. It tried setting the permission of the myresize* files to 777 755 644 etc, yet it doesnt work. Any clue as to why I am getting this error?

I even tried changing the auto-resize to off in config.php

I am at my wits end and will appreciate all the help I can get.

Thanks

 
joan
joan's picture

Joined: 2002-10-21
Posts: 3473
Posted: Fri, 2003-11-21 00:03

Upgrade to 1.4.1 (RC4 is just out).

These features are now built into Gallery.

 
2fargon

Joined: 2003-10-25
Posts: 7
Posted: Fri, 2003-11-21 00:35
joan wrote:
Upgrade to 1.4.1 (RC4 is just out).

These features are now built into Gallery.

I am sorry, but I cant find myresize.php in Gallery 1.4.1 RC4.
So is there an alternative method in 1.4.1 RC4 to resize photgraphs that have already been uploaded?

Thank you for the pointer

 
joan
joan's picture

Joined: 2002-10-21
Posts: 3473
Posted: Fri, 2003-11-21 09:46

Bugger! I had thought beckett had code this into resize_photo.php (which is where it will appear). But it's not in 1.4.1. Sorry.

Resize originals on upload is there, though.

 
2fargon

Joined: 2003-10-25
Posts: 7
Posted: Fri, 2003-11-21 17:26
joan wrote:
Bugger! I had thought beckett had code this into resize_photo.php (which is where it will appear). But it's not in 1.4.1. Sorry.

Resize originals on upload is there, though.

It does resize, but it , for some strange reason, makes two copies, one .sized.jpg and one .jpg, both of the same size!!

The " resize all " option in the albums doesn't seem to be working either. Should I file a bug report (then again, i currently dont know how to, but could learn from some faq).

Thanks, Joan, I really appreciate you taking the time and interest!! I love you folks :)

 
tomsawyer123
tomsawyer123's picture

Joined: 2002-07-24
Posts: 81
Posted: Sat, 2004-01-31 14:50

Beckett,

I use your script for several month and it works great until today.

I have rezised 250 pict which where 650p "max. size" to 600p "max. size" and I had an increase of 15mg! I don t understand. All my album are set to " no resize".

I have try to decrease the quality of jpeg in the setup process form 90 to 80 and resize all those 250 pics again and it didn't improove the situation.

I month ago, i have change the gallery code for the image to be resized on upload. Is it possible that there is a bad interraction with those two codes?

Is it possible to choose the jpeg quality of the pictures resized by myresize.php.

Thanks for your help.

Tom

 
Vidman
Vidman's picture

Joined: 2002-07-20
Posts: 38
Posted: Sun, 2004-02-22 15:09

myresize r0X0r5!!!!1

113 albums, 2725 images running 1.4.2: I went from 710 megs to 449 in one sweep! No timeouts, no problems. It took 3-5 minutes to complete.

However, in order to run myresize.php I had to increase the php memory limit from 10 to 15. I stuck this in my root .htaccess:

<IfModule mod_php4.c>
php_value memory_limit 15M
</IfModule>

Prior to running the script I changed my config to the following:
$gallery->app->jpegImageQuality = "70";
$gallery->app->default["resize_size"] = "off";
$gallery->app->default["resize_file_size"] = "0";
$gallery->app->default["max_size"] = "600";
$gallery->app->default["max_file_size"] = "80";

In myresize.php I specified 600 as the max size, and left the .sized textbox blank. This got rid of all the .sized images and shrunk the originals down. The size of some of the images my users uploaded was rediculous.. some were pushing 1MB!! This script recovered 261 megs.

 
schillid

Joined: 2004-03-23
Posts: 1
Posted: Tue, 2004-03-23 20:55

Any word on getting myresize.php to work with embedded galleries? I'm running gallery with phpBB and would love to have this!

 
grafikat

Joined: 2004-03-31
Posts: 8
Posted: Sat, 2004-06-12 21:57

I just upgraded, and was looking at the resize function. When to the website, and his gallery is broken! is this because resize does not work with the new update? Just wanted to know before I tried it

Cheers
Kat

 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3474
Posted: Sat, 2004-07-10 04:08

myresize v0.3 available:

http://beckettmw.com/testgallery

Should fix the issues you're having.

-Beckett (

)