Jump to content

UniDBGrid Picture from URL


Anthoni

Recommended Posts

Hi,

 

I am trying to display some information to the user (a list of Youtube videos to be precise) and I want to display the Thumbnail as well.

How do I get the picture displayed in a UniDBGrid?

 

I thought, originally about creating a Frame and placing a normal UniImage on there and then displaying that BUT then I realized I needed

to be able to actually allow the user to sort. Hence the Grid :)

Link to comment
Share on other sites

UniDBImage?

OK, so I might not fully understand, or explained myself properly.

I am grabbing the Youtube information via their API system, performing some calculations and then storing the results in a Generic List.

The list contains TYoutubeResults class and in that class I have a property called ThumbURL which is a string to the thumbnail of said video.

 

Now in order to show this in a DBGrid I am aware I need to populate a DBMemTable and then add that as Datasource for the DBGrid, however

given that the URL is only a string, how do I tell it to display (fetch the image) instead of displaying a string?

 

Hopefully that's explained it a bit better :)

Link to comment
Share on other sites

however

given that the URL is only a string, how do I tell it to display (fetch the image) instead of displaying a string?

Create calculated widestring field, and use html tags

DataSet.FieldByName('calc_youtube').AsString := Format('<img src="%s">', [DataSet.FieldByName('youtube_url').AsString]);
Link to comment
Share on other sites

 

Create calculated widestring field, and use html tags

DataSet.FieldByName('calc_youtube').AsString := Format('<img src="%s">', [DataSet.FieldByName('youtube_url').AsString]);

Would I still use the DBGrid FieldImageURL event ?

Basically I am not 100% sure where to put that code.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...