Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

can attach detect image height and width

Quote Reply
can attach detect image height and width
Hi,

Does anyone know if the attach_file can determine the height and width of an image when it gets attached.

If so, when the image gets attached couldn't we do something like


fd = whatever the source would for this info.

like we do for type
$ft = $in->uploadInfo($fh) ? $in->uploadInfo($fh)->{'Content-Type'} : 'application/octet-stream';

Then add a field to the attach database called FileDimension and stick fd in there.

Anybody have any ideas on this? It would be really use full information.

I tried changing Content-Type to Content-Dimensions
Content-Dimension
Dimensions
Content_Structure
Structure

Is it available?


Thanks and peace.

Kyle
Quote Reply
Re: can attach detect image height and width In reply to
Do you have some code that can detect image sizes for both .gif, .png or .jpg? If so, saving that info wouldn't be too hard to do.

Cheers,

Alex
Quote Reply
Re: can attach detect image height and width In reply to
Hmmm... I don't have any code. I was actually wondering if the height and width info was already available to use the same way that it is in Netscape or IE.

FOR EXAMPLE -
When you look at an image and select View Page Info (Netscape) and View Properties (IE) somehow the browser know the SIZE of the image as well as the TYPE of the image, the DIMENSIONS of the image and whole bunch of other stuff.

Now In LinksSQL - It seems magical(I'm not being sarcastic) that you know the type of image and the file size of the image but not the dimensions. I assumed the dimensions were accessible, but that you didn't bother accessing the information in the script. Am I wrong?

So... Is the information readily available?

OR

Did YOU write some code that specifically detects the type of the image and the size? Aren't you accessing the header information by saying:

$in->uploadInfo($fh) ? $in->uploadInfo($fh)->{'Content-Type'}

Isn't there another ?variable? to access beside Content-Type that would give me the height and width of an image? I'm not sure I'm using the right terminology here...

Anyway, If you wrote code that detects the Content-Type, where exactly is it if not in attach_file. I looked for it and couldn't find it. As far as I can tell, attach_file doesn't call for any subroutine. I looked for a subroutine called upload but can' find that.

Admittedly, how the file actually gets from my hardrive to the server is pretty mysterious and magical. I have alway felt like I haven't found the proper subroutine that does this.

mystified,

Kyle

Quote Reply
Re: can attach detect image height and width In reply to
To find the ht/width of an image you have to actually "read" it. That information is stored inside the bitmap - usually in the header. Netscape and MSIE need to know that information to lay out a page, so they read it, store it, and use it.

Programs such as FTP don't, so it's not readily available. You'd have to add the code to actually find that information from the file.

It's a feature I need too, but it's somewhere still down on my list, and I haven't gotten to it. I sent alex some code he might be able to use to build that functionality in. I want to go one step further, and add a thumbnail to a "thumbnail" subdirectory of each upload directory/file.....





------------------
POSTCARDS.COM -- Everything Postcards on the Internet www.postcards.com
LinkSQL FAQ: www.postcards.com/FAQ/LinkSQL/








Quote Reply
Re: can attach detect image height and width In reply to
I have some code to see the height and width of gif or jpg; if still needed, ask, i will post it then.
By the way has someone solved the problem with upload when modifing by user?
Im still stuck on this.
Robert