Jump to content

UniDBGrid Picture from URL


Anthoni
 Share

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...