I have written an application that stores photos, keeping the path to the photos in an database. I have encountered a problem. When I click my button to select the picture I want to display in an TImage object for the user to view before saving, I receive the following exception notification: raised exception class: EInvalidGraphic with message "Unknown picture extension (.jpg)'
I'm using an TopenPicture component to go and fetch the image. the openPicture.filter property is set to accept most of the image formats, (jpg, jpeg, png, gif, bmp), but I cannot load any of these formats into the TImage component.
Here is the code I'm using to load the image:
openPicture.Execute();
filename := openPicture.FileName;
if not(fileName = '') then
begin
imgFoto.Picture.LoadFromFile(filename);
imgFoto.Visible := true;
end;
Add JPEG
to the uses clause in the interface section.
This automatically registers .jpg
as valid image file extension and couples it to the TJPEGImage
class which TPicture
will instantiate.