resize images library? Options
Gregorius
Posted: Friday, September 22, 2006 2:46:56 PM

Rank: Aficionado

Joined: 7/29/2006
Posts: 491
Location: Melbourne, Australia
yeah fair enough... just wanna avoid having images scale up higher than the original... better off just showing a small original file (u know when users upload photos taken on their mobile phones, etc).

anyone know how to interrogate an image file to discover its width or height? then it'd just be an extra function in imagegen.aspx to first check size of image before resizing.

Sometimes when I'm alone, I google myself...
neehouse
Posted: Friday, September 22, 2006 2:59:37 PM
Rank: Umbracoholic

Joined: 7/20/2006
Posts: 1,018
Location: Charleston, West Virginia, United States
The resize function is probably already getting the size if it is sizing proportionally. You may just want to place a parameter into the resize function that passes a boolean value for 'allowEnlarge', and then check that the sizes are bigger than the specified size.

• 2007 - 2008 MVP • Charleston, WV, USA • umbracoholic since Dec. 2004 (v.2.0) •
Achieved umbracoholic status on 2008-04-25
Gregorius
Posted: Friday, September 22, 2006 3:05:10 PM

Rank: Aficionado

Joined: 7/29/2006
Posts: 491
Location: Melbourne, Australia
good point case... i'll check it out when i get a chance.

Sometimes when I'm alone, I google myself...
desmo
Posted: Sunday, October 01, 2006 6:09:28 AM

Rank: Aficionado

Joined: 7/19/2006
Posts: 144
Location: NYC
Doug,

Just implemented ImageGen on a very image-intensive site, and I'm very very impressed with the power and speed of your software.

I'm putting up a site with LOTS of really nice images so it's getting a good work-out. I'll post a link when it launches in a few weeks.

Thanks much!!

- Mark

Manhattan Heavy Industries

“Algorithms are small but beautiful”, Dr. Karp observed.
Gregorius
Posted: Thursday, January 04, 2007 6:29:58 AM

Rank: Aficionado

Joined: 7/29/2006
Posts: 491
Location: Melbourne, Australia
hey all,

revisiting this old topic, is there a way to set the quality at which imagegen compresses images? I'm finding on the site i'm building that some images are not looking too good when compressed with imagegen - i'd like to set it to compress at setting of say 70-90 for jpeg images, but can't find how to... any suggestions?

otherwise, its a huge timesaver!

Sometimes when I'm alone, I google myself...
neehouse
Posted: Thursday, January 04, 2007 1:49:35 PM
Rank: Umbracoholic

Joined: 7/20/2006
Posts: 1,018
Location: Charleston, West Virginia, United States
I am also dealing with something similar to your request. I was thinking of trying an httpHandler for the media section that the url could call the image with the size specified in the path, and a script would handle it the way you mention.

ie: /media/xxxxxxxxxxx/file/100x100/image.aspx

nGallery does this to a point, so I was thinking of robbing some of their code. :P

Case

• 2007 - 2008 MVP • Charleston, WV, USA • umbracoholic since Dec. 2004 (v.2.0) •
Achieved umbracoholic status on 2008-04-25
drobar
Posted: Thursday, January 04, 2007 3:06:31 PM

Rank: Umbracoholic

Joined: 9/8/2006
Posts: 1,082
Location: KY, USA
ImageGen has a ton of options, including the compression ratio for JPEG images, sizing, padding, borders, overlaying text on top of an image, changing an image's format, transparency, etc. etc. There is full documentation in the PDF that comes with the download.

Use the COMPRESSION attribute for improving the quality of your JPEGs (the default is 80).

Code:

<img src="/umbraco/ImageGen.aspx?image=/images/big.jpg&width=100&compression=95" />


cheers,
doug.

MVP 2007/2008 - Official Umbraco Trainer for North America - Percipient Studios
neehouse
Posted: Thursday, January 04, 2007 3:39:35 PM
Rank: Umbracoholic

Joined: 7/20/2006
Posts: 1,018
Location: Charleston, West Virginia, United States
Is there any way to get source on ImageGen? Some of my clients are requiring it...

• 2007 - 2008 MVP • Charleston, WV, USA • umbracoholic since Dec. 2004 (v.2.0) •
Achieved umbracoholic status on 2008-04-25
Gregorius
Posted: Friday, January 05, 2007 12:22:22 AM

Rank: Aficionado

Joined: 7/29/2006
Posts: 491
Location: Melbourne, Australia
Thanks for the info Doug... i've tried adding the &compression=95 to my xslt where its calling the images, restarted umbraco, deleted cache folder, and reloaded the page, but its still compressing at 80 (according to the xml file in the cache folder)... any ideas why?

Sometimes when I'm alone, I google myself...
Gregorius
Posted: Friday, January 05, 2007 12:36:33 AM

Rank: Aficionado

Joined: 7/29/2006
Posts: 491
Location: Melbourne, Australia
Sorry, i'm a goose - was editing the wrong xslt. all good now :)

Sometimes when I'm alone, I google myself...
phazer
Posted: Thursday, February 08, 2007 1:47:34 PM
Rank: Newbie

Joined: 2/8/2007
Posts: 3
First of all, I've got to say, I really like Umbraco and the ImageGen plugin. I know from first hand (I'm a developer myself) that making all of this costs a lot of time and effort, keep up the great work!

But (yeah, there's always a "but".. ;)), I found a drawback to the ImageGen plugin. If you look at the source of an image generated by ImageGen, copy the url and paste it in your browser, you'll find that it's quite easy to flood a server.

Just change the width and height properties (imagegen.aspx?image=/media/***/***.jpg&width=99999&height=99999) to very large numbers and ImageGen starts calculating and stores everything in the cache dir of the server.

Is there a solution to this problem? (besides NOT using ImageGen ofcourse.. ;))
drobar
Posted: Thursday, February 08, 2007 3:24:25 PM

Rank: Umbracoholic

Joined: 9/8/2006
Posts: 1,082
Location: KY, USA
This is an interesting problem. ImageGen is not hacker proof in the sense that someone could change the query string parameters if they wanted to... possibly to the server's detriment. Have you seen this kind of problem in practice, or are you just trying to alleviate a potential problem?

I've thought of adding a configuration file that would specify default parameters for ImageGen. Primarily I was thinking about obfuscating the path to the original image with a default path in a config file. That way a visitor wouldn't know the full path to the image being resized and therefore couldn't grab the original. I suppose something similar could be done with other parameters (and parameters could be added for ImageGen for this purpose), such as a maximum height and width and a flag for not allowing an image to be resized larger than the original. These global settings wouldn't be available to be overridden with a querystring setting so that would give some level of protection against bad people.

The basic problem is that ImageGen uses the query string to pass in parameters. This makes ImageGen very powerful and flexible and easy to integrate with a web site, especially sites that are created dynamically. But it can also be a weakness, as you've noted.

Does anyone have any ideas how that weakness might be handled without crippling ImageGen's strengths?

thanks!
doug.

MVP 2007/2008 - Official Umbraco Trainer for North America - Percipient Studios
thomwhaites
Posted: Thursday, February 08, 2007 3:40:26 PM
Rank: Fanatic

Joined: 7/20/2006
Posts: 253
Location: Boston, Massachusetts
Hi Doug,

Could you allow for a configuration setting which caps the max size imageGen will scale up to? I'd also love it if you could disable scale-up.

Also, can you crop with imageGen? That'd be very useful for a few sites I've got going.

I'd like to echo everyone's sentiment - great plug-in!

Tom
neehouse
Posted: Thursday, February 08, 2007 7:44:35 PM
Rank: Umbracoholic

Joined: 7/20/2006
Posts: 1,018
Location: Charleston, West Virginia, United States
The crop functionality came up recently for me as well. For that matter, they want it to be smart, and crop the best part of the image... Anybody have any thoughts.

• 2007 - 2008 MVP • Charleston, WV, USA • umbracoholic since Dec. 2004 (v.2.0) •
Achieved umbracoholic status on 2008-04-25
warren
Posted: Thursday, February 08, 2007 7:59:13 PM

Rank: Addict

Joined: 7/19/2006
Posts: 584
Location: Leigh-on-Sea, Essex, UK
To crop the best part automatically is very difficult as the most interesting area is not always in the center of the photo/image.

I think the fail safe way is to have a seperate upload for thumbnail/cropped image personally as you can vary the crop zoom and coordinates from photo to photo.

If you want a cropper you would need some form of GUI to allow the user to specify the crop they wanted.

Thats my 2 cents on it.
Warren

Warren Buckley - Umbraco MVP 07 & certified level 1 developer | Creative Web Specialist - Warren Buckley's Blog
phazer
Posted: Thursday, February 08, 2007 8:38:20 PM
Rank: Newbie

Joined: 2/8/2007
Posts: 3
Hi Douglas,

Thanks for the reply. I haven't seen any misuse of ImageGen (yet). But I was experimenting with ImageGen for my own site and saw the potential risk.

I think that adding a configuration file would solve the problem. Maybe it's possible to make it so, that ImageGen accepts querystring properties by default, but if you set a property in the configuration file, it doesn't accept querystring properties anymore.

This way, ImageGen is still backwards compatible and very easy to integrate (if you don't mind about the potential risk) and if you do mind, just use the configuration file to override the querystring properties.
thomwhaites
Posted: Thursday, February 08, 2007 8:54:58 PM
Rank: Fanatic

Joined: 7/20/2006
Posts: 253
Location: Boston, Massachusetts
For me, even the ability to crop to a specific dimension just from the center of the image would be great. I do that now in some layouts with just css overflow hidden, but that's the top left corner, centered would usually be better.

Tom
desmo
Posted: Thursday, February 08, 2007 8:55:34 PM

Rank: Aficionado

Joined: 7/19/2006
Posts: 144
Location: NYC
Warren Buckley (Creative Web Specialist) wrote:

To crop the best part automatically is very difficult as the most interesting area is not always in the center of the photo/image.


I looked into this a bit. On Flickr, they do cropping, and I think they always pick the center, and it _usually_ looks good. I would be happy with an option for that.

Check out any of the square images on Flickr to see what I mean.

I've told Doug that he should consider taking donations. ImageGen is just so useful!

- Mark


Manhattan Heavy Industries

“Algorithms are small but beautiful”, Dr. Karp observed.
bootnumlock
Posted: Thursday, February 08, 2007 10:51:13 PM

Rank: Fanatic

Joined: 10/9/2006
Posts: 317
isn't there something in the config file that protects textgen from being called directly or am i crazy, couldn't the exact thing be applied to imageGen.aspx as well???

bootnumlock - aka bob baty-barr [http://www.baty-barr.com]
bootnumlock
Posted: Thursday, February 08, 2007 11:02:52 PM

Rank: Fanatic

Joined: 10/9/2006
Posts: 317
okay, that didn't work for me... what the heck is that setting for anyway?

bootnumlock - aka bob baty-barr [http://www.baty-barr.com]
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.