?
Solved

Variable image sizes (jpg, gif and bmp) in a Crystal Report

Posted on 2003-03-26
3
Medium Priority
?
458 Views
Last Modified: 2013-11-19
Using VB 6 and Crystal Reports 8.5, I'm trying to produce a report that includes photos relating to the file summary I am generating.  Each report can have any number of photos included, and the images can be either BMP, JPG or GIFs.  The filepath and filename for each photo is pulled from the database at runtime.

By creating the report with a dummy photo and then using LoadPicture to replace it with the correct photo, I've had no problems loading each image.  My problem is that each photo is compressed or expanded to fit the dimensions of the initial dummy photo.  I need to be able to resize each photo to its original dimensions.  I know how to handle the resizing, but can't figure out how to determine the images' real dimensions at runtime.  I've seen one function to determine bitmap dimensions using header information, but need something to handle JPG and GIF files as well.

Any suggestions?

Code so far (in the Report Designer):

Private Sub Photos_Format(ByVal pFormattingInfo As Object)
    Dim iPhotoWidth As Integer
    Dim iPhotoHeight As Integer
   
    ' sPhotoPath is a variable for the filepath that is set when initializing the report.  
    ' PhotoFileName is a suppressed field containing the filename of the photo (e.g. 137.jpg)
    Set Photo.FormattedPicture = LoadPicture(sPhotoPath & PhotoFileName.Value)

' Determine photo dimensions
    iPhotoWidth = ???                  ' need function
    iPhotoHeight = ???                 ' need function
' Resize photo
    Photo.Width = iPhotoWidth
    Photo.Height = iPhotoHeight
End Sub
0
Comment
Question by:JGraham
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 28

Accepted Solution

by:
AzraSound earned 500 total points
ID: 8213914
"Get Information about Image Files"
http://www.freevbcode.com/ShowCode.Asp?ID=2275
0
 

Author Comment

by:JGraham
ID: 8218278
Thanks very much.  That's exactly what I needed.
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 8218314
Glad I could help  :-)
0

Featured Post

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!

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
In this Micro Tutorial viewers will learn the basic shortcuts and functions in InDesign.
In addition to being a great web-based presentation tool, Prezi also makes it easy to save your presentation as a PDF to share with others as well. Learn how in this tutorial. Select the share icon from the top menu in your Prezi editor: Select "D…
Suggested Courses
Course of the Month13 days, 2 hours left to enroll

777 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