Need help using #PIC_TEXT# variable when Creating Webpage

Ask for help and post your question on how to use XnView Classic.

Moderators: XnTriq, xnview

Post Reply
User avatar
2wings.com
Posts: 3
Joined: Tue Feb 25, 2014 7:22 pm

Need help using #PIC_TEXT# variable when Creating Webpage

Post by 2wings.com » Tue Feb 25, 2014 8:09 pm

I'm new to the Xnview forum, but a long time fan of the software. I've tried searching as much as possible for an answer but cannot seem to find anything.

I'm having trouble using the #PIC_TEXT# field or variable when creating the individual webpages from a group of images using the "page.html" template.

I'm not sure, maybe Xnview might be working ok, and I just cannot find any way to input text data into the metadata of an image file for Xnview to then pull out again using the #PIC_TEXT# call in the templates.

Right now the #PIC_TEXT# always return nothing. I've tried loading up an image with every IPTC field that pops up with Ctrl- i, and also have tried adding meta data using windows file explorer properties dialog, but nothing seems to work. Maybe #PIC_TEXT# is data in the image that I cannot even control or edit or input?

My goal is to be able to add a caption to the iptc metadata of an image, and then when I generate webpages for that image, have the caption of the image be put into a PHP variable so I can then have my website use the caption text in the the HTML <title> tag.

I've figured out how to successfully use a bunch of the other tags as PHP variables, here's the template for my "page.html," Right now, it seems no matter what I do, the PHP variable $TitleTagText always comes out to be "" which tells me that xnview isn't finding anything in the image to put there:

Code: Select all

<?php 
	$PATH = '../../../';
	$image_title		=	'#FILENAME#';
	$image_alt			=	'#FILENAME#';
	$prev_page			=	'#PREV_PAGE#';
	$next_page	 		=	'#NEXT_PAGE#';
	$filename				=	'#FILENAME#';

	$TitleTagText			=	'#PIC_TEXT#';
	$pic_width			=	#PIC_WIDTH#;
	$pic_height			=	#PIC_HEIGHT#;


	include $PATH."inc/image_page.php";

?>

As you can see the "page.html" template makes individual image webpages that are really just PHP code with variables filled in by xnview, which my website then uses along with the image to display a page like shown here:
http://www.2wings.com/m12/images/sn291/ ... _2219.html

Maybe there is some other way I could use the IPTC caption field from an image?

Any help or possible solutions would be appreciated!

User avatar
XnTriq
Moderator & Librarian
Posts: 5456
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Need help using #PIC_TEXT# variable when Creating Webpag

Post by XnTriq » Tue Feb 25, 2014 10:00 pm

Welcome to newsgroup.xnview.com, 2wings.com (-:

Please try…
  • Create » Web Page... » Information displayed » Insert >> » IPTC- Caption » Caption (<IPTC:Caption>)
… or…

Code: Select all

$TitleTagText = '#<IPTC:Caption>#';
TorstenT ([url=http://newsgroup.xnview.com/viewtopic.php?t=3151&p=14876#p14876]Webpage templates: List of keywords[/url]) wrote:Those "<...>" keywords are all merged into the value of the #PIC_TEXT#, so you can "transfer" all sorts of stuff from the image into your webpage. BTW, a very smart thing; as I found out you can even combine them with any free text and even HTML-tags!
helmut ([url=http://newsgroup.xnview.com/viewtopic.php?t=3780&p=18171#p18171]HTML templates: what are the IPTC/EXIF tags ?[/url]) wrote: Currently, the field "Show information" is the only way to insert IPTC and EXIF data. There are no placeholders which could be used in the HTML template, yet. I also think that this would be a useful and important enhancement.

User avatar
2wings.com
Posts: 3
Joined: Tue Feb 25, 2014 7:22 pm

Re: Need help using #PIC_TEXT# variable when Creating Webpag

Post by 2wings.com » Wed Feb 26, 2014 5:07 pm

XnTriq wrote:Welcome to newsgroup.xnview.com, 2wings.com (-:

Please try…
  • Create » Web Page... » Information displayed » Insert >> » IPTC- Caption » Caption (<IPTC:Caption>)
… or…

Code: Select all

$TitleTagText = '#<IPTC:Caption>#';
XnTriq,

Awesome! That worked perfectly. It also opens my eyes to new possibilities of using IPTC data in the images. Thank you very much for the help, and of course much thanks to Pierre for such an awesome program. I think I'll make another donation to him!

User avatar
XnTriq
Moderator & Librarian
Posts: 5456
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Need help using #PIC_TEXT# variable when Creating Webpag

Post by XnTriq » Wed Feb 26, 2014 10:45 pm

2wings.com wrote:Awesome! That worked perfectly. It also opens my eyes to new possibilities of using IPTC data in the images. Thank you very much for the help, and of course much thanks to Pierre for such an awesome program. I think I'll make another donation to him!
I'm glad to hear that you find it useful, 2wings.

And for completeness' sake:
  • #TITLE#
    #HEADER#
    #COLUMN_COUNT#
    #THUMB_TABLE_START#
    #THUMB_ROW_START#
    #THUMB_ROW_END#
    #THUMB_START#
    #THUMB_END#
    #THUMB2_START# Image
    #THUMB2_END# Image
    #OUTPUT_FOLDER# Image
    #FRAME_PAGE#
    #THUMB_PAGE#
    #THUMBNAILS_LABEL#
    #PREV_PAGE#
    #PREVIOUS_LABEL#
    #NEXT_PAGE#
    #NEXT_LABEL#
    #THUMB_SUBPATH#
    #PREFIX_THUMB#
    #THUMB_FILENAME#
    #THUMB_TEXT#
    #THUMB_LINK#
    #THUMB_WIDTH#
    #THUMB_WIDTH_MAX# (v2.35+) Image
    #THUMB_HEIGHT#
    #THUMB_ALT#
    #ORG_SUBPATH#
    #FILENAME#
    #PIC_TEXT#
    #PIC_LINK#
    #PIC_WIDTH#
    #PIC_HEIGHT#
    #PIC_ALT#
    #PAGE_GENERATED#
(See also: Webpage templates: List of keywords)
  • IPTC - Caption
    • #<IPTC:Caption># (Caption)
      #<IPTC:Caption Writer># (Caption Writer)
      #<IPTC:Headline># (Headline)
      #<IPTC:Special Inst.># (Special instruction)
    IPTC - Keywords & Categories
    • #<IPTC:Keywords># (Keywords)
      #<IPTC:Category># (Category)
      #<IPTC:Sup. Category># (Supplemental categories)
    IPTC - Credits
    • #<IPTC:Copyright># (Copyright)
      #<IPTC:Byline># (Byline)
      #<IPTC:Byline Title># (Byline Title)
      #<IPTC:Credits># (Credit)
      #<IPTC:Source># (Source)
    IPTC - Origin
    • #<IPTC:Edit Status># (Edit status)
      #<IPTC:Priority># (Priority)
      #<IPTC:Cycle># (Object cycle)
      #<IPTC:Job ID># (Job ID)
      #<IPTC:Program># (Program)
    IPTC - Status
    • #<IPTC:Object Name># (Object Name)
      #<IPTC:Created Date># (Date Created (YYYYMMDD))
      #<IPTC:Released Date># (Release Date (YYYYMMDD))
      #<IPTC:City># (City)
      #<IPTC:Sublocation># (Sublocation)
      #<IPTC:State># (State/Province)
      #<IPTC:Country># (Country)
      #<IPTC:Country Code># (Country code)
      #<IPTC:Original Trans. ref.># (Original transmission reference)
      #<IPTC:Contact># (Contact)
      #<IPTC:Location># (Location)

User avatar
XnTriq
Moderator & Librarian
Posts: 5456
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Need help using #PIC_TEXT# variable when Creating Webpag

Post by XnTriq » Fri Feb 28, 2014 4:00 am

The samples and template (updated) used in my tests:
[color=green]%ProgramFiles%\XnView\WebTemplate\_Test\page.html[/color] wrote:

Code: Select all

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta name="generator" content="XnView">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>XnView Web Template Variables</title>
<style type="text/css">
<!--
table {
width: 100%;
border-collapse: collapse;
background-color: #f0f0f0;
}
th, td {
padding: 0.5em;
text-align: left;
vertical-align: top;
color: black;
font-size: 12px;
font-family: monospace;
}
thead tr th {
color: white;
text-transform: uppercase;
font-weight: bold;
}
tbody tr th {
white-space: nowrap;
}
tbody tr td {
word-wrap: break-word;
}
tbody tr th,
tbody tr td {
color: black;
font-weight: normal;
}
thead tr      th      { background-color: #303030; }
thead tr      th.Even { background-color: #484848; }
tbody tr      th      { background-color: #e2e2e2; }
tbody tr.Even th      { background-color: #dadada; }
tbody tr      td      { background-color: #e8e8e8; }
tbody tr.Even td      { background-color: #e2e2e2; }
tbody tr:hover        { background-color: rgba(0, 0, 0, 0.10); }
// -->
</style>
</head>
<body>
<table>
	<thead>
		<tr>
			<th>Variable</th>
			<th class="Even">Output</th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<th>&#35;TITLE&#35;</th>
			<td>#TITLE#</td>
		</tr>
		<tr class="Even">
			<th>&#35;HEADER&#35;</th>
			<td>#HEADER#</td>
		</tr>
		<tr>
			<th>&#35;COLUMN_COUNT&#35;</th>
			<td>#COLUMN_COUNT#</td>
		</tr>
		<tr class="Even">
			<th>&#35;THUMB_TABLE_START&#35;</th>
			<td>n/a</td>
		</tr>
		<tr>
			<th>&#35;THUMB_ROW_START&#35;</th>
			<td>n/a</td>
		</tr>
		<tr class="Even">
			<th>&#35;THUMB_ROW_END&#35;</th>
			<td>n/a</td>
		</tr>
		<tr>
			<th>&#35;THUMB_START&#35;</th>
			<td>n/a</td>
		</tr>
		<tr class="Even">
			<th>&#35;THUMB_END&#35;</th>
			<td>n/a</td>
		</tr>
		<tr>
			<th>&#35;THUMB2_START&#35;</th>
			<td>n/a</td>
		</tr>
		<tr class="Even">
			<th>&#35;THUMB2_END&#35;</th>
			<td>n/a</td>
		</tr>
		<tr class="Even">
			<th>&#35;OUTPUT_FOLDER&#35;</th>
			<td>#OUTPUT_FOLDER#</td>
		</tr>
		<tr>
			<th>&#35;FRAME_PAGE&#35;</th>
			<td>#FRAME_PAGE#</td>
		</tr>
		<tr class="Even">
			<th>&#35;THUMB_PAGE&#35;</th>
			<td>#THUMB_PAGE#</td>
		</tr>
		<tr>
			<th>&#35;THUMBNAILS_LABEL&#35;</th>
			<td>#THUMBNAILS_LABEL#</td>
		</tr>
		<tr class="Even">
			<th>&#35;PREV_PAGE&#35;</th>
			<td>#PREV_PAGE#</td>
		</tr>
		<tr>
			<th>&#35;PREVIOUS_LABEL&#35;</th>
			<td>#PREVIOUS_LABEL#</td>
		</tr>
		<tr class="Even">
			<th>&#35;NEXT_PAGE&#35;</th>
			<td>#NEXT_PAGE#</td>
		</tr>
		<tr>
			<th>&#35;NEXT_LABEL&#35;</th>
			<td>#NEXT_LABEL#</td>
		</tr>
		<tr>
			<th>&#35;THUMB_SUBPATH&#35;</th>
			<td>#THUMB_SUBPATH#</td>
		</tr>
		<tr>
			<th>&#35;PREFIX_THUMB&#35;</th>
			<td>#PREFIX_THUMB#</td>
		</tr>
		<tr class="Even">
			<th>&#35;THUMB_FILENAME&#35;</th>
			<td>#THUMB_FILENAME#</td>
		</tr>
		<tr>
			<th>&#35;THUMB_TEXT&#35;</th>
			<td>#THUMB_TEXT#</td>
		</tr>
		<tr class="Even">
			<th>&#35;THUMB_LINK&#35;</th>
			<td>#THUMB_LINK#</td>
		</tr>
		<tr>
			<th>&#35;THUMB_WIDTH&#35;</th>
			<td>#THUMB_WIDTH#</td>
		</tr>
		<tr>
			<th>&#35;THUMB_HEIGHT&#35;</th>
			<td>#THUMB_HEIGHT#</td>
		</tr>
		<tr class="Even">
			<th>&#35;THUMB_ALT&#35;</th>
			<td>#THUMB_ALT#</td>
		</tr>
		<tr>
			<th>&#35;ORG_SUBPATH&#35;</th>
			<td>#ORG_SUBPATH#</td>
		</tr>
		<tr class="Even">
			<th>&#35;FILENAME&#35;</th>
			<td>#FILENAME#</td>
		</tr>
		<tr>
			<th>&#35;PIC_TEXT&#35;</th>
			<td>#PIC_TEXT#</td>
		</tr>
		<tr class="Even">
			<th>&#35;PIC_LINK&#35;</th>
			<td>#PIC_LINK#</td>
		</tr>
		<tr class="Even">
			<th>&#35;PIC_WIDTH&#35;</th>
			<td>#PIC_WIDTH#</td>
		</tr>
		<tr>
			<th>&#35;PIC_HEIGHT&#35;</th>
			<td>#PIC_HEIGHT#</td>
		</tr>
		<tr class="Even">
			<th>&#35;PIC_ALT&#35;</th>
			<td>#PIC_ALT#</td>
		</tr>
		<tr>
			<th>&#35;PAGE_GENERATED&#35;</th>
			<td>#PAGE_GENERATED#</td>
		</tr>
		<tr class="Even">
			<th>&#35;<IPTC:Caption>&#35;</th>
			<td>#<IPTC:Caption>#</td>
		</tr>
		<tr>
			<th>&#35;<IPTC:Caption Writer>&#35;</th>
			<td>#<IPTC:Caption Writer>#</td>
		</tr>
		<tr class="Even">
			<th>&#35;<IPTC:Headline>&#35;</th>
			<td>#<IPTC:Headline>#</td>
		</tr>
		<tr>
			<th>&#35;<IPTC:Special Inst.>&#35;</th>
			<td>#<IPTC:Special Inst.>#</td>
		</tr>
		<tr class="Even">
			<th>&#35;<IPTC:Keywords>&#35;</th>
			<td>#<IPTC:Keywords>#</td>
		</tr>
		<tr>
			<th>&#35;<IPTC:Category>&#35;</th>
			<td>#<IPTC:Category>#</td>
		</tr>
		<tr class="Even">
			<th>&#35;<IPTC:Sup. Category>&#35;</th>
			<td>#<IPTC:Sup. Category>#</td>
		</tr>
		<tr>
			<th>&#35;<IPTC:Copyright>&#35;</th>
			<td>#<IPTC:Copyright>#</td>
		</tr>
		<tr class="Even">
			<th>&#35;<IPTC:Byline>&#35;</th>
			<td>#<IPTC:Byline>#</td>
		</tr>
		<tr>
			<th>&#35;<IPTC:Byline Title>&#35;</th>
			<td>#<IPTC:Byline Title>#</td>
		</tr>
		<tr class="Even">
			<th>&#35;<IPTC:Credit>&#35;</th>
			<td>#<IPTC:Credit>#</td>
		</tr>
		<tr>
			<th>&#35;<IPTC:Source>&#35;</th>
			<td>#<IPTC:Source>#</td>
		</tr>
		<tr>
			<th>&#35;<IPTC:Edit Status>&#35;</th>
			<td>#<IPTC:Edit Status>#</td>
		</tr>
		<tr class="Even">
			<th>&#35;<IPTC:Priority>&#35;</th>
			<td>#<IPTC:Priority>#</td>
		</tr>
		<tr>
			<th>&#35;<IPTC:Cycle>&#35;</th>
			<td>#<IPTC:Cycle>#</td>
		</tr>
		<tr class="Even">
			<th>&#35;<IPTC:Job ID>&#35;</th>
			<td>#<IPTC:Job ID>#</td>
		</tr>
		<tr>
			<th>&#35;<IPTC:Program>&#35;</th>
			<td>#<IPTC:Program>#</td>
		</tr>
		<tr class="Even">
			<th>&#35;<IPTC:Object Name>&#35;</th>
			<td>#<IPTC:Object Name>#</td>
		</tr>
		<tr>
			<th>&#35;<IPTC:Created Date>&#35;</th>
			<td>#<IPTC:Created Date>#</td>
		</tr>
		<tr class="Even">
			<th>&#35;<IPTC:Released Date>&#35;</th>
			<td>#<IPTC:Released Date>#</td>
		</tr>
		<tr>
			<th>&#35;<IPTC:City>&#35;</th>
			<td>#<IPTC:City>#</td>
		</tr>
		<tr class="Even">
			<th>&#35;<IPTC:Sublocation>&#35;</th>
			<td>#<IPTC:Sublocation>#</td>
		</tr>
		<tr>
			<th>&#35;<IPTC:State>&#35;</th>
			<td>#<IPTC:State>#</td>
		</tr>
		<tr class="Even">
			<th>&#35;<IPTC:Country>&#35;</th>
			<td>#<IPTC:Country>#</td>
		</tr>
		<tr>
			<th>&#35;<IPTC:Country Code>&#35;</th>
			<td>#<IPTC:Country Code>#</td>
		</tr>
		<tr class="Even">
			<th>&#35;<IPTC:Original Trans. ref.>&#35;</th>
			<td>#<IPTC:Original Trans. ref.>#</td>
		</tr>
		<tr>
			<th>&#35;<IPTC:Contact>&#35;</th>
			<td>#<IPTC:Contact>#</td>
		</tr>
		<tr class="Even">
			<th>&#35;<IPTC:Location>&#35;</th>
			<td>#<IPTC:Location>#</td>
		</tr>
	</tbody>
</table>
</body>
</html>

User avatar
2wings.com
Posts: 3
Joined: Tue Feb 25, 2014 7:22 pm

Re: Need help using #PIC_TEXT# variable when Creating Webpag

Post by 2wings.com » Tue Mar 04, 2014 7:29 pm

Thanks for the information, it's nice to have added documentation on this powerful ability of xnview.

Post Reply