Page 1 of 1

Multi-page images (that old chestnut)

Posted: 16 Dec 2015 14:18
by ColeValleyGirl
As it isn't currently possible to include a (multi-page) PDF file as media and have it show up when generating a website, I thought I'd convert my multi-page PDFS to multi-page TIFFs; not ideal (very few browsers support the format) but better than dozens -- in some cases -- of single-page images.

And yes, (not even a muted hurrah): Multi-page TIFFS do show up when generating a web-page... or rather, the first page shows up as the Tiff is converted to a JPG file! So I'm back at square one.

Is there any way to make the website generation honour the media type of images? Or does anyone have an alternative solution to multi-page sources? I'd settle for displaying a link to the PDF or TIFF that would open the file when invoked.

Re: Multi-page images (that old chestnut)

Posted: 16 Dec 2015 15:08
by tatewise
I have not checked this yet, but worth a try.

In the Source record that has the PDF Media add a web address for it.
It can be in any field that you include in Sources in your Reports.
My Improve Website or CD DVD HTML Plugin should convert it to a hyperlink.
So just make sure the web address is your full domain name plus the PDF filename.

And remember to upload the doc.pdf file to your website!!

Re: Multi-page images (that old chestnut)

Posted: 20 Dec 2015 16:59
by ColeValleyGirl
That works in a simplistic fashion, Mike -- and if I use the Custom ID field, it shouldn't have much impact on the portability of the GEDcom.

However... it is going to be a very error-prone set of manual steps, and still has limitations:

1. It depends on adding the same information twice to a source -- once as media and once as a custom ID -- which will no doubt get forgotten and/or get out of synch, as well as offending the IT-purist in me!

2. It requires the pdf (or other non-image file) to be copied to the right place manually before uploading the website.

3. If the target website address changes, every instance of the old website address in the GEDcom needs to be located and updated.

The main drawback is that it only supports a single non-image media file per source (so no image pdf plus formatted text transcription in a separate pdf file, for example). (Using Source Note might alleviate this, except Source Note is much more likely to be used for conventional purposes.)

I've not yet been able to see a way to automate much of this -- perhaps a plugin could be run to check each source for 'non-image' media and copy (the first-found) filepath/filename to Custom ID, before the website is generated. And optionally prompt for the website address, perhaps, so that changes to the target url could be handled automatically.

Once the website is generated, the next step would be to 'Improve' it (to convert the custom ID to a properly formed URL).

Then the relevant files would have to be copied to the right place in the generated website structure (not sure how they'd be identified).

And then I still need to come up with a solution for dealing with non-image media attached to a fact, where there isn't a convenient 'spare' field that can be used to hold a file URL...

All of which still seems a remarkably cumbersome way to do something that is handled as standard in other website generators. GEDmill for example includes non-image files linked to sources as downloadable files as standard in its source detail pages... but I can't do my usual cut-and-stitch from a set of GEDmill output files into a set of FH website files (or even write a plug-in to splice in non-image files after website generation) because FH loses the unique source identifier when it (for example) generates source citations in an individual's web-page.

There doesn't seem to be much interest in the wish list in handling PDF files, but I'll submit a suggestion anyway...

[As an aside, the Improve Website plugin silently truncates urls with spaces in them rather than leaving them alone or reporting an error...]

Re: Multi-page images (that old chestnut)

Posted: 20 Dec 2015 17:31
by Valkrider

Don't forget that Tiff is not a widely web supported image format. Only Safari will render Tiff images so that limits you to Those on a Mac using it and the handful still with the old windows version of Safari.

Re: Multi-page images (that old chestnut)

Posted: 20 Dec 2015 17:37
by ColeValleyGirl
@Colin, agreed -- using multi-page TIFF wouldn't be a solution even if FH didn't turn then into single page JPGs.

Re: Multi-page images (that old chestnut)

Posted: 20 Dec 2015 18:10
by tatewise
Yes, it is not ideal, but there are possible simplifications.

1. Cannot do much about this as there has to be something in the web page report.

2. With some extra 'magic codes' (see below) the Improve... Plugin could copy non-image files.

3. With some extra 'magic codes' (see below) the target domain name & folder can be eliminated.

Have you tried putting two or more URL in the Custom Id field? It should work.

Yes, a preliminary Plugin could create the 'magic codes' automatically.

Copying of non-image files could be done by the Improve... Plugin.

For Fact non-image files the CAUSe field could be used, and the word Cause: removed by Improve... Plugin. Likewise it could remove Custom Id: from web page. BTW:Narrative reports would need Sentence Template to include Cause:.

The Improve... Plugin should only remove leading and trailing white space/layout chars from URL that should not have any spaces at all, but could substitute + for space, which is interpreted as a space.

The 'magic codes' could be based on <a href="">Domain</a> format already supported, or a {{MEDIA:folder\filename}} format. See Improve... Plugin Help & Advice page for Hyperlinks / Text. Then the Plugin would know the path to the non-image file, so it can be copied, and thus know how to format the hyperlink.

Re: Multi-page images (that old chestnut)

Posted: 20 Dec 2015 21:56
by jimlad68
just a simple thought. How about combining the images into 1 long PNG image (canvass).

There are various methods to do this, photoshop or ICE see ... ditor.html, a bit long winded but I sure there are "quick methods"

One reason I like PDFs is that if there is any text in the image it can be OCRed and henced searched on and also easier to print if required. So if you use a single image, keep your originals, a good thing anyway so you can always go back to the original quality.

Also, I always use PNG when possible as it is lossless, compressed and browser friendly. I would have thought many pages on TIFF (or PNG) would be very slow to load.

Re: Multi-page images (that old chestnut)

Posted: 20 Dec 2015 23:14
by tatewise
I imagine a very long multi-page (Helen mentioned dozens of pages) PNG shown in a report would be unreadable.

Re: Multi-page images (that old chestnut)

Posted: 21 Dec 2015 12:29
by ColeValleyGirl

The "Magic codes" approach has promise, as it would mitigate the risks associated with manual double data-entry, by using a preliminary plug-in to populate a field that will pass through into the report with the relevant media details (ideally honoring any flags set on the media to exclude the file from reports, although this wouldn't be essential) and then the 'Improve' plug-in to manipulate the output to include a link to the right file in the right place.

I'd favour using a local Note if possible for the field used to pass into the report, as it avoids conflicts with pukka uses of other fields -- for example, I routinely use CAUS for cause of death, so it wouldn't be a good choice for media associated with a death event, and others may use the Custom ID on a source to hold a reference to a location in the paper filing system.

@Jim, @Mike, I agree that a multi-page PNG in a report would be unreadable -- although I rarely if ever use reports except to generate web pages (with pop-ups on the images) so its a lesser issue for me. A bigger issue with any multi-page image format for me is (1) the contortions needed to get a PDF or RTF or TXT file into an image file; and (2) a preference to minimise the duplicate formats in which I hold a source.

Re: Multi-page images (that old chestnut)

Posted: 21 Dec 2015 13:44
by tatewise
When I get a moment :lol: might be able to create a prototype Improve... Plugin for the 'magic code' approach.

It should not matter which field is chosen to hold the 'magic code' even if the field is used for something else, because I hope the Plugin will extract the 'magic code' and create the Media hyperlink on a separate line, leaving any other field content intact or removing the label for blank content.

Regarding the management of the Media files, do you favour them all being in one folder along with all the other FH Wizard generated web pages, or in a Media sub-folder structure that mirrors the Project Media folder? An advantage of the latter is that the Media files only need be uploaded once, because although the FH Wizard empties its web site folder it does not touch sub-folders. I use that technique to hold custom .css files as described in Knowledge Base > Family Tree Tips ~ Alter CSS Default Styles.

Also would it be useful for the 'magic code' to define a caption to display instead of the filename in the hyperlink?
Magic code: {{MEDIA:Folder\Filename|Caption text}}
Hyperlink: <a href="folder/filename">Caption text</a>

Re: Multi-page images (that old chestnut)

Posted: 21 Dec 2015 14:37
by ColeValleyGirl

Personally I'd prefer the sub-folder approach, but others might find the other approach more familiar.

A caption would be an excellent enhancement.

Re: Multi-page images (that old chestnut)

Posted: 22 Dec 2015 10:57
by tatewise
Helen, please try ATTACHMENT Improve Website or CD DVD HTML Plugin Version 2.7.1 Date 22 Dec 2015.
[ ATTACHMENT deleted as superseded by later version. ]

You can always revert to Plugin Store version if necessary, but no previous functionality has been affected.

You only need to use the Hyperlinks / Text tab of the Plugin.

It should accept the {{MEDIA:file|text}} magic code in just about any text field that appears in reports, but any Note field is good, such as Individual Record local Note, or Fact local Note, or Source local Note.

The file part must be same as Linked File field of Media record, either relative or absolute path.
Relative paths define the folder path plus filename within the web page folder.
Absolute paths use a media sub-folder plus filename within web page folder.
All paths are reduced to lower case, with space chars changed to underscore.
If the web page folder plus filename already exists, then the file is not copied.

The text part may contain \n if you want a line break.
If |text is omitted then the filename is used instead, without the folder path.

If anything does not appear to work correctly, then please post snippets of the XHTML code before and after using Plugin.

Re: Multi-page images (that old chestnut)

Posted: 22 Dec 2015 13:12
by ColeValleyGirl
Mike -- thank you. As far as I have been able to test it, it works very well.

Re: Multi-page images (that old chestnut)

Posted: 24 Dec 2015 14:38
by tatewise
I have been giving this issue a bit more thought.

A significant snag in general with the {{MEDIA:file|text}} magic code is that it may often appear in Reports where not wanted when published for other purposes. The other magic codes do not suffer that problem, as they are usually added within the Publish > Website/CD/DVD Wizard dialog, not the Reports themselves.

So I have hatched a cunning plan!
What if we fooled FH into creating standard image Media popups for all non-image Media?
Then all the standard options for creating Captions, excluding Media, etc, would apply.
All the Improve Website... Plugin then has to do is convert those image popup hyperlinks to non-image hyperlinks, which is easy since it already recognises those XHTML formats. All it needs to know is the non-image Filename path for each Media Record Id.

I propose that the Improve Website... Plugin has a preliminary option on the Image Popups tab to replace all File links for non-image Media with a tiny dummy JPEG file. The original File link could be preserved in the Media record in say its Last Change Note > Note field &/or a Plugin Data file. Note that these changes can be reversed using Edit > Undo Plugin Updates at any time prior to closing FH.

Then the Publish > Website/CD/DVD Wizard is executed as normal, followed by the Improve Website... Plugin, which reverses the non-image File link changes, converts the non-image Media hyperlinks, and copies the non-image Media files to the Website/CD/DVD folder.

What do you think?

Re: Multi-page images (that old chestnut)

Posted: 24 Dec 2015 14:53
by ColeValleyGirl
That sounds like a significant improvement, Mike.

Re: Multi-page images (that old chestnut)

Posted: 26 Dec 2015 20:57
by tatewise
The ATTACHMENTS Improve Website or CD DVD HTML Version 2.7.3 Date 26 Dec 2015 offers the new feature discussed earlier, but still retains the {{MEDIA:file|text}} magic code feature.
[ ATTACHMENT deleted as superseded by later version. ]

So to use the new feature, run the Plugin and on its Media Popups tab click the Turn non-image Media into icons button.

This replaces each non-image Media File link with a link to a matching JPG Icon file.
It preserves the original Format and File fields in the Last Change Note.

Now Publish > Create a Website/CD/DVD as usual, which will honour all the Media settings for non-image Media just like any other Media.

If you check the resulting web pages that include non-image Media there will be a PDF or Word or Text or other JPG Icon for each such Media, and clicking them will simply popup the icon.

Finally, run the Plugin again and on its Media Popups tab click the Convert all media file Popups ... button.

This copies the original non-media file to a media sub-folder of the web pages folder.
It converts the Icon popups so they hyperlink to those non-media files.
It restores the original Format and File fields from the Last Change Note.
If there happens to be a real Last Change Note then that is retained.

To reverse the effect of the first Plugin button, then either use Edit > Undo Plugin Updates, or use the second Plugin button without using Publish > Create a Website/CD/DVD.

To maintain DOCTYPE XHTML 1.0 Strict compatibilty the non-image Media hyperlinks do NOT use target="_blank" so may open the document on same tab/window. However, this can be altered by using the Hyperlinks / Text tab of the Plugin.

The Plugin should cope with Filenames that use accented characters in the ANSI set.

One downside is that the Update date/time of non-image Media records gets updated.
However, if the whole process is performed successively in one session, then two uses of Edit > Undo Plugin Updates gets back to where you started.

BTW: The JPG Icon files are downloaded from FHUG Knowldege Base to the C:\ProgramData\Calico Pie\Family Historian\Plugin Data folder as necessary, when the first Plugin button is first used. The set of JPG Icon files can be easily expanded to give specific icons for RTF, audio, video, or other file types.

FYI: I think it should be quite easy for Calico Pie to add this feature to FH because the non-image Media hyperlink structure is so similar to the image Popup structure.

Re: Multi-page images (that old chestnut)

Posted: 27 Dec 2015 10:17
by ColeValleyGirl
Mike, I will test this as soon as I can but it may not be for a day or so (am waist-deep in css at present and only slowly winning...)


Re: Multi-page images (that old chestnut)

Posted: 27 Dec 2015 22:58
by tatewise
No hurry Helen.

The ATTACHMENT below is a slightly refined Version 2.7.4 Date 27 Dec 2015.

This adds similar icons to the {{MEDIA:file|text}} magic code feature.

There are also a few more defensive checks and coding efficiencies.

I suggested the 'tweak' to include non-image Media in website pages to Simon Orde, and got a favourable response, but no promise of implementation.

[EDIT: Attachment deleted as Plugin is now in Plugin Store.]

Re: Multi-page images (that old chestnut)

Posted: 05 Jan 2016 11:04
by ColeValleyGirl

I've now tested version 2.7.4 and it works perfectly, I particularly like the fact that all media linked to sources and/or events are handled consistently, but there is also an option to include a PDF file 'inline' in a report using the Magic Code feature, which will allow me to include (for example) documents that explain why I've reached a particular conclusion and have those documents show up immediately adjacent to the conclusion, which is very helpful. I might make the icons smaller when they're inline like that, but that's something I can handle if necessary

Many thanks for this -- it adds 'document' support in websites that has been sadly missed. It would be great if Simon Orde can include it in the mainstream product at some point in the future, but in the meantime you've delivered an excellent solution.


Re: Multi-page images (that old chestnut)

Posted: 05 Jan 2016 11:36
by tatewise
That is good feedback Helen.
I will wait until FH V6.1 is officially released, just in case Simon adds the feature, and then publish the Plugin in the Plugin Store.

The Plugin Help & Advice will need updating, and it may be wise to add a popup message to the Turn non-image Media into icons button to explain the subsequent steps.

Re: Multi-page images (that old chestnut)

Posted: 06 Mar 2016 14:08
by ColeValleyGirl
Mike, I guess this needs to go to the plugin store as the equivalent functionality didn't make it into 6.1?


Re: Multi-page images (that old chestnut)

Posted: 06 Mar 2016 14:23
by tatewise
You are probably right, although I am not certain that V6.1.4 is the final release, because there are still plenty of outstanding issues not specifically to do with importing from FTM/Ancestry. For example, there are still plenty of 'minor' bugs, several missing Help pages, and the promised Getting the Most From Family Historian 6.

Re: Multi-page images (that old chestnut)

Posted: 06 Mar 2016 14:29
by ColeValleyGirl
Mike, true -- but I'd be very (pleasantly) surprised if this functionality was included in 6.1.x.

Re: Multi-page images (that old chestnut)

Posted: 27 Jun 2016 11:49
by tatewise
The Improve Website or CD DVD HTML Version 2.8 Date 27 Jun 2016 has now been added to the Plugin Store as it appears that the non-image media icon upate is not likely to appear in FH shortly despite Simon Orde giving it a favourable response