In nice applications usage of thumbnails (or previews) of your pictures is a necessity. It speeds up things when you use small pictures to show small pictures instead of shrinking big pictures everytime.
Thumbnails generation in Microsoft Access can be done with one line of code using AccessImagine.
So, lets take all the 3 steps to add thumbs to your pictures in some table.
1. Lets make some place for holding thumbs. Create a new field of OLE (or BLOB) type and call it Preview
2. Then make AccessImagine write a preview – add this line to the Exit event handler of control (lets assume its name is Picture1):
If Picture1.Changed Then Preview.Value = Picture1.PreviewJPG(128)
128 here means that the height (or width, if pic is landscape) will be 128 pixels. If you omit this number, then it will default to 64.
3. Then u need to… emm… Have we promised 3 steps for you? It was just a joke – we are done in two steps.
There is one note about previews here – they are generated at the moment user puts or changes image, so dont expect to generate previews for whole database with this two steps.
Hi, I’m trying to create 2 images in an external path the big one an a preview one based on the big one. How can we do this by using your component? I have tried several ways and only works the one that store the preview image in a OLE field… Any ideas?
There is an advantage of making OLE preview – you can use it in continous forms to display small pictures.
But if you really need previews to be saved externally, you can use second AccessImagine object for this. just make it small or invisible somehow, and setup it: setup StoragePath folder (other then original images), bind it to the field for Preview pictures names, set MaxWidth and Max Height.
After set this string for OnExit handler of original image to copy it to preview AccessImagine control:
If Picture1.Changed Then AccessImaginePreview.Image = Picture1.Image
That sounds a bit complicated, but its really simple when you do it.
Write us at access@bukrek.net if you need further assistance.
Hi,this control has really helped me a lot, so thanks!
I have two questions though:
Is there any way to have the pictures tied to the original file so that if the file is not on the computer (say, saved on a USB flashdrive) the picture won’t show? I know it is an odd request, but it is for security reasons for here at work.
Secondly, I was wondering if you could do more video tutorials to go with the written ones? I’m a beginner with Access, and so a lot of these instructions are a little hard to follow sometimes, and I’ve found that I am a very visual learner.
Please and thank you!
Greetings!
AccessImagine have external image storage option, that will perfectly fit your case. You can read about it here – http://access.bukrek.net/tutorial/storage
Sandie, which topics, to your opinion, should be video-tutorialized?
If it’s not too much trouble, the “thumbs”, “pictures in continuous forms”, and the “how to keep pictures somewhere else” tutorials would all benefit from videos. I’m sure they’re easy enough to understand for people who have worked with Access, but beginners like me (who are self teaching besides ha!) have a little trouble. Eventually I figure it out, but I think it would be helpful for others who aren’t so tech savvy.
And Thank you so much for answering, I’ve never had someone be so prompt for instructions and it’s awesome!
Sandie, thanks you for your hints, we will create such video-tutos in a while.
Feel free to write if you need any assistance.
From what I can tell, when the preview is set to OLE it sets the image to bmp is there a way to save an additional image besides the primary and preview images in another field but in a jpeg format. Currently I have a “Picture” field a “Preview” field using OLE(128) and would like to save a different size image in a third field called “PrevJPG” using PreviewJPG(128). Can I make this happen using the on exit event and have it save to both fields “Preview” and “PrevJPG” in the different bmp and jpg respectfully, if so what would the syntax be?
Thank you,
Kevin
Nothing special here:
If AccessImagine1.Changed Then
Preview.Value = AccessImagine1.PreviewOLE(128)
PrevJPG.Value = AccessImagine1.PreviewJPG(128)
End If
Thanks Max!
I had done it that way I must have had an error in my syntax or something. It works fine now.
This is probably a really silly question, but I can’t figure out how to make the picture smaller on the form without it showing as cropped.
Which property do a set that is the same as ZOOM on an ACCESS object?
Hello!
I’ve tried to use this method to make possible to see the images on a continuous form, but apparently it’s not possible to do it without editing or adding again a new image.
So, how can I do to generate previews for every image of the database without editing or adding a new image?