Jump to content

How to load main topic or page picture as thumbnail?

Featured Replies

Posted

If we upload an image to "Default share image" in Customization > Appearance > Icons & Logos, that's the picture that's going to load if we paste a forum link on WhatsApp, for example.

However, if the topic or page in question has a picture, how can we make the engine use that picture instead of the default share image? In other words, how can we make the default share image load only when the topic or page has no pictures?

This behavior is similar to Facebook, YouTube, etc.

Edited by BlackShot

  • Author
  On 06.08.2022 at 05:02, AHristich said:

BlackShot If I understood you correctly, the solution is here

Hmmm... I was talking about something like this:

2022_08.06_21_04_51.155_o6gzD.thumb.png.c5576cc48052b8dd409974b3c6202b83.png

The issue with the forums is that it doesn't search for an image within the posts. It always displays the same default picture uploaded to "Icons & Logos".

Edited by BlackShot

  • Author

This app almost does what I'm looking for... except it changes the whole forum, but doesn't seem to change external thumbnails shown on WhatsApp, Facebook, etc.

Maybe someone can help improve it?

File attached: https://invisioncommunity.com/files/file/7436-bim-topic-thumbnail/

(BIM) Topic Thumbnail 4.6.0.tarFetching info...

  • Author
  On 08.08.2022 at 21:59, by_ix said:

I asked this question a couple of times, but didn't get it.

О, это несчастье! Как вы думаете, вы можете проверить приложение, которым я поделился, и посмотреть, сможете ли вы его отредактировать? Кажется, что он делает большую часть работы в этом смысле.

  • Author
  On 08.08.2022 at 22:09, by_ix said:

BlackShot If there is time for this, I will not promise anything.

Спасибо. Приложение, которое я вам отправил, автоматически захватывает основные фотографии тем и превращает их в миниатюры. Может быть, вам просто нужно изменить тему. Я пытался искать, но не смог найти.

@HooLIGUN ты хорошо разбираешься в таких вещах? 9_9

  On 06.08.2022 at 04:41, BlackShot said:

how can we make the engine use that picture instead of the default share image

Когда вы передаете ссылку на сторонний ресурс (Фейсбук, WhatsApp и т.д.), ваше изображение (передаваемое вместе со ссылкой) может учитываться этим ресурсом, а может не учитываться. Ресурс может самостоятельно выбирать картинку по своим критериям для вашей публикации.

Edited by Zero108

  • Author
  On 09.08.2022 at 11:21, ZIKURIK said:

захукать надо метатег который выводит картинку, например og:image и подставить изображение туда

Хм, я думаю, что приложение, которое я разместил там, уже делает это. Но почему-то не работает. Не могли бы вы рассказать нам пошагово, ZIKURIK? 🤔

  • Author

It is easier than I thought. I found this answer on another forum:

Go to post template and add this to the top:

{{if !isset(\IPS\Output::i()->metaTags['og:image'])}}
	{{preg_match('~<img[^>]*?src="(<fileStore.core_Attachment>([^"]*))"[^>]*>~i', $comment->content(), $matches); }}
	{{if isset($matches[1])}}
		{{\IPS\Output::i()->parseFileObjectUrls($matches[1]);}}
		{{\IPS\Output::i()->metaTags['og:image'] = $matches[1];}}
	{{endif}}
{{endif}}

@by_ix

Edited by BlackShot

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Ответить в этой теме...

Последние посетители 0

  • No registered users viewing this page.