PDA

View Full Version : Help a programmer - Finding an image size - HTML, Coldfusion, javascript



Marmoot
27th January 2006, 16:20
Help me....I'm stuck.
I have a utility that allows users to upload 5 images and a page that should display the image horizontally, scaled to either maximum width 100 or maximum height 100.

However, I CANNOT FIND THE BLOODY IMAGE SIZE FROM THE FILE.

I program mostly using Coldfusion, and my host server banned the use of CFFILE ACTION=READ for security reason :crybaby:

Anyone has any method that can help me? I'll give you 2 green blings.....that's all I can give :crybaby:

Pathos
27th January 2006, 16:28
cfif val(cgi.content_length)

will give the total data size...


meh misread the post. I dont really do cold fusion

Marmoot
27th January 2006, 16:38
Thanks, but I need the image width&height, not the filesize.

Users can only upload jpg and gif.

Pathos
27th January 2006, 16:50
ok from a quick surf I don't think cf actually loads images into memory as a image structure, it handles them simply as standard files so you need some code to find the values with low level file access.

gif and jpeg are read here:
http://groups.google.com/group/alt.comp.lang.coldfusion/msg/af84ac7dfec0d09e?dq=&hl=en&lr=&ie=UTF-8&oe=UTF-8&rnum=8

Pathos
27th January 2006, 16:52
ok cf has to be one of the most inefficient imperitive languages on the planet.

couldn't they group code in &lt?cf tags or something like php?

Marmoot
27th January 2006, 18:02
Oh gees....that was hard work...took me entire day to figure out.

Anyway, thanks for helping.
After begging to the server admin, they somehow allow my cffile.

So I read the entire jpeg/gif file into 1 variable and parse it and did this and that and it worked.

I've got the code if anyone is interested or need it at some point.

Cheers guys