last entries Thumbnail

Find help with FlatPress plugins, report a plugin bug, request or present new plugins.
Post Reply
dart
Posts: 58
Joined: Sun May 30, 2021 4:46 pm

last entries Thumbnail

Post by dart » Sun Dec 11, 2022 11:21 pm

as the title reads...
Is it possible to add a thumbnail to show per last entries if an image is present in the topic ?

User avatar
Arvid
FlatPress Coder
Posts: 558
Joined: Sat Jan 26, 2019 7:40 pm
Contact:

Re: last entries Thumbnail

Post by Arvid » Sat Dec 17, 2022 12:35 pm

Hi,

this would make a nice new plugin, say "LastEntriesWithThumbnails" :)
My thoughts: Take the original LastEntries plugin, rename it, and then:
  • Set the fullparse parameter in the new FPDB_Query() call to true (line 29) to retrieve not only the metadata of the entries, but also their contents.
  • In the while ($q->hasmore()) loop (line 39), you then have access to each entry's content via $entry ['content'] - parse the content for the first "img" tag and read its "src" parameter, and you have your thumbnail image path.
  • Add the image path to the $string variable within a html <img> tag to actually display the image in the widget output.
Little coding fun, anyone? :)

dart
Posts: 58
Joined: Sun May 30, 2021 4:46 pm

Re: last entries Thumbnail

Post by dart » Thu Dec 29, 2022 2:41 pm

well, at least I know it's possible somehow :lol:

Post Reply

Who is online

Users browsing this forum: No registered users and 22 guests