Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Picture / Object size

Posted on 2000-04-17
6
Medium Priority
?
197 Views
Last Modified: 2013-11-26
I need to use the AppendChunk/GetChunk methods with an ADO recordset. The example in the MSDN uses the ActualSize property to get the object size but I want to put a picture from a file (via loadpicture). I basically need to find out the object size in order to break it into chucks for the append and get chunk methods.

By object size - I DON'T mean width or height, I mean the byte size in total.

Thanks,

StuJ
0
Comment
Question by:scj1
  • 3
  • 2
6 Comments
 
LVL 43

Expert Comment

by:TimCottee
ID: 2722692
Check the filesize, this will give you the answer

    Dim lngFileSize As Long
    Open "Picture.bmp" For Binary Access Read As #1
    lngFileSize = LOF(1)
    Close #1
    MsgBox lngFileSize
0
 
LVL 1

Author Comment

by:scj1
ID: 2722742
Ok, I have though of this but that will only help if the picture is a bitmap file. Is there a way of getting the size from the object reference?

Thanks.
0
 
LVL 1

Expert Comment

by:Ask_ED
ID: 2722853
Hi,

Tim's got the right idea and it isn't limited to only bitmaps any file type (GIF/TIF/JPG..etc) can be sized that way... but I'd recommend using the FileLen function instead.

msgbox FileLen(pathname)

If you use the FileLen function, you do not have to explicitly "open" then file, thereby eliminating that overhead.

Hope this helps
ED
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:scj1
ID: 2723132
The point here though, I realise that the file length, however you get it, will return the filesize. However, I wasn't planning on storing the file but rather the file contents. Thus, if a jpeg or compressed gif/bmp/etc. is used, the ipicturedisp object will generally be the same despite differing file sizes (lossy compressed files excepted from this rule).
0
 
LVL 1

Accepted Solution

by:
Ask_ED earned 300 total points
ID: 2723366
Hi Again,

Isn't your goal to find the ammount of data you need to append to the database ???

Knowning the size in memory of the 'object' isn't going to help you append to the database.

Unless you have a high-end graphics control or class you are still going to have to save the image back to the disk before appending it to the database, so the important value is the file size and the object size is a "nice to know", but not required bit of data.


Am I missing something here ?

Bye for Now
ED
0
 
LVL 1

Author Comment

by:scj1
ID: 2747891
I've actually solved the problem now and as you rightly said, I did need to save the object to disk before I could right it to the database. This does, however, seem a bit of a wasteful way of doing things - wouldn't it be better if I could just put the object in memory to the database rather than through a broken up file. After all, what is the image datatype for otherwise?

Cheers,

Stuart
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

927 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question