Web based family history software

file Question What's the best way to include a photo (from a media item) in a story?

  • Graeme
  • Graeme's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
11 months 1 week ago - 11 months 1 week ago #1 by Graeme
Having logged in as admin and naively copied photo URLs from the media manager into Stories... an example is
Code:
https://family.my.site/admin/media-file?path=media%2FThe-hockey-team.jpg

I am able to see the photos inline when logged on as admin but not as a member. It's fairly obvious why (doh!) and after experimenting I find that I can make photos visible using URLs of this form:
Code:
https://family.my.site/tree/myfamily/media-download?xref=X521&fact_id=9fd1a8991f6e0b739bd779779e5f735e&disposition=attachment&mark=0

So this would seem to be the correct route... or is it? What is the best way include photos in stories, please?

If URLs in the above form are the best way what are the parameters disposition and mark, and what values are best to use for them?




 
Last edit: 11 months 1 week ago by Graeme.

Please Log in or Create an account to join the conversation.

More
11 months 1 week ago #2 by fisharebest
disposition = inline/attachment

This is added to the HTML header, and gives a clue to the browser what to do with the file.

mark = 0/1

Add a watermark. If you try to view an image without a watermark, and you do not have permission to do so, then you should get a 403/not-allowed response.

Greg Roach - greg@subaqua.co.uk - @fisharebest@phpc.social - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

More
11 months 1 week ago #3 by fisharebest
Alternatively (and simpler), just put a copy of the image you want in the /public/ folder and link directly to that.

Greg Roach - greg@subaqua.co.uk - @fisharebest@phpc.social - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

  • Graeme
  • Graeme's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
11 months 1 week ago #4 by Graeme
Thanks. I'll take the first solution to avoid duplicating images.

Please Log in or Create an account to join the conversation.

More
11 months 1 week ago #5 by HRN

Thanks. I'll take the first solution to avoid duplicating images.

 
I do the same. However, mark = 0/1 does not seem to work as intended. It turns out that the images added in Stories (and HTML-block) are stored in browser cache, and will be displayed with/without watermark depending on login status on the first visit

webtrees 2.2.1 patched at visitusinmaputo.com/webtree PHP 8.3.16
webtrees 2.2 on local Wampserver 3.3.7 PHP 8.3.14/8.4.0 MySQL 9.1.0/MariaDB 11.5.2

Please Log in or Create an account to join the conversation.

More
11 months 1 week ago #6 by Peter_S
Another option is to mark the needed OBJE records with RESN = NONE. In this case, the images can remain in the media folder. 

Peter

webtrees 2.1.22, vesta modules, chart modules of magicsunday, extended family and imprint of hartenthaler
PHP 8.3.12, MariaDB 10.11.8
Webhosting: genonline.de

Please Log in or Create an account to join the conversation.

More
11 months 1 week ago #7 by HRN
Well, I want to keep watermarks for visitors.
Logged in users should be able to to see unmarked images, without having to clear browser cache

webtrees 2.2.1 patched at visitusinmaputo.com/webtree PHP 8.3.16
webtrees 2.2 on local Wampserver 3.3.7 PHP 8.3.14/8.4.0 MySQL 9.1.0/MariaDB 11.5.2

Please Log in or Create an account to join the conversation.

More
11 months 1 week ago #8 by fisharebest
> Logged in users should be able to to see unmarked images, without having to clear browser cache

You want to have one URL that will display two different images according to whether the user is logged in.

This won't work.

The current design has a mark=0/1 parameter to prevent browser caching. Otherwise a user would see a watermark, then log in, and the browser would show the cached image with watermark instead of fetching the same image again.

Similarly, after logging off, we don't want them to see a cached image without a mark.

Greg Roach - greg@subaqua.co.uk - @fisharebest@phpc.social - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

More
11 months 1 week ago #9 by HRN

The current design has a mark=0/1 parameter to prevent browser caching. Otherwise a user would see a watermark, then log in, and the browser would show the cached image with watermark instead of fetching the same image again.

Similarly, after logging off, we don't want them to see a cached image without a mark.

Yes, I understand this design. The problem is that it is not working in Stories and HTML block. (it works as intended on rest of the site)
In Stories and HTML block the cached image is displayed regardless of mark=0/1 parameter

webtrees 2.2.1 patched at visitusinmaputo.com/webtree PHP 8.3.16
webtrees 2.2 on local Wampserver 3.3.7 PHP 8.3.14/8.4.0 MySQL 9.1.0/MariaDB 11.5.2

Please Log in or Create an account to join the conversation.

Powered by Kunena Forum