Custom Web Gallery Questions...

  • Thread starter Thread starter davidmknoble
  • Start date Start date
Status
Not open for further replies.
D

davidmknoble

Guest
I have been taking a hand at programming custom web galleries and I have come across two items that stump me and I cannot find guidance. I am hopeful someone here can help. Here are the questions:

1) Is there any way to create another panel in the web gallery column? I.e., there is Image Info, Output Settings, etc., Can I create one Called 'My Panel' in the lrweb file?

2) Is there a way in the manifest file to copy a file from 'fixedname.html' to 'variablename.html' where the variablename is a text item input in the template. I.e., if I have an item defined as metadata.htmlfilename and set the value to metadata.htmlfilename.value = 'newfilename.html', then how do I set the output filename? I have tried [[metadata.htmlfilename.value]], I have tried <%= metadata.htmlfilename.value %> and other permutations.

Any suggestions would be greatly valued!
 
I've moved your thread into Plugin Discussion where the best web designers hang out.
 
1) Not currently, it's in as a feature request though.

2) I don't know.
You can call variables in manifest, so it seems likely,
They seem to be called directly though:

AddGridPages {
template='grid.html',
rows=model.nonCSS.numRows,
columns=model.nonCSS.numCols,


Maybe try metadata.htmlfilename.value on it's own with no enclosures.
 
Thinking on this further, it may not be possible.

Gallery directives are processed in a certain order. The HTML pages, work this way, as described by Andy Rahn:

1. Consume input file, expand all include files to create one complete page.
2. Convert file into Lua source code.
3. Compile it.
4. Run it, capturing output.

The problem is that you might try to refer to a variable in the
include that hasn't been defined yet. For example:

<% local foo = "page1.html" %>


The problem is that the include is processed in step 1, while the variable isn't defined until step 4. There is no way to know what $foo is equal to without compiling and executing the source first -- but we can't do that because we don't have the entire source yet.

The above was explained to me by Andy, and here I extrapolate a bit and draw my own conclusions. The gallery uses the manifest file to know what files it needs to process. That is, it uses the manifest to determine which files it needs to run through the process above. I would therefore conclude that the manifest file is processed prior to the execution of the above steps, and that the variables would not be defined at the time the manifest is processed. This would make it impossible to define the output name for a file from a variable.
 
I agree that order of processing is key.

In this case, I am looking to input a variable in the panels for the web gallery, read that value and use it to rename an output page. So I think in this case, the variable is declared prior to pressing export or upload.

I'll try it and let you know.

I would think that using a variable that is nested within other files rather than the main gallery.lrweb file would have the potential to fail.

Thanks for the replies.

David.
 
Ok, good news. I have it working. Here is what I found:

The identity plate code in the manifest.lrweb file is as follows:

Code:
IdentityPlate {
	destination='resources/images/idplate.png',
	enabledBinding = [[appearance.idplate.display]],
}

Notice how the css variable is called by using double square brackets. Later in the same file, I use the following code:

Code:
AddPage {
	template='optionalpage.html',
	filename= model.metadata.optionalHTMLPageName.value,
}

Here I am taking a variable input at creation of the gallery by the user and calling it to rename the the output file for that particular page. Notice how there are no brackets or otherwise surrounding the variable call.

When this processes, I end up with a file that is named after the variable input. In this case it allows me to have a custom rename for an additional file to include in the gallery generation.

Thanks for all your help. I have a few other questions I will also post in this same forum (the plugins).
 
Stuck on AddGridPages and Non Index.html pages

Ok, new question. I have a page named blankpage.html. It has gallery in it from the standpoint that I have a div with id=gallery and it shows one image using the tags:

Code:
<div id="gallery">
  <img src="photos/<%= getImage(1).exportFilename %>.jpg class=xx height=xx width=xx alt=xx />
</div>
I am trying to use the manifest to generate this file as a custom.html filename so that I can use the template multiple times in a web site with different filenames each time.

If I use the AddPage approach only like this:

Code:
AddPage {
    template='index.html',
    filename=model.metadata.htmlPageName.value,
}
Then I get an error in LR that says 'working, content is being generated...cannot demangle /index.html'

I dont' know what this means.

If I use the AddGridPages approach like this:

Code:
AddGridPages {
    template='index.html',
    rows=1,
    columns=1''',
}
Then I get the correctly generated web page in Lightroom. But, when I export it, obviously it overwrites the index.html page each time.

So then I use this code instead:

Code:
AddGridPages {
    template='index.html',
    filename=model.metadata.htmlPageName.value,
    rows=1,
    columns=1''',
}
LR reads this fine and shows the web page, but when I upload it, the page is still named 'index.html' and not the value of the variable.

Soooo, then I change the name of the template in the AddGridPages to this:

Code:
AddGridPages {
    template='blankpage.html',
    filename=model.metadata.htmlPageName.value,
    rows=1,
    columns=1''',
}
And guess what, I get a file named 'index.html'. Now this manifest doesn't even reference index.html, so the question is then:

How can I use the function AddGridPages to call a certain template and name it a different file on output? Do I have to delete the index.html from the template gallery to avoid getting it??
 
Sean, do you mean use two AddGridPages commands, one for the index.html and one for the second page, like this:

AddGridPages {
template='index.html',
filename='tempdir/index.html',
rows=1,
columns=1''',
}

AddGridPages {
template='blankpage.html',
filename=model.metadata.htmlPageName.value,
rows=1,
columns=1''',
}
or were you thinking something different?

Thanks for the reply.
 
You can only use one AddGridPages, but I'm sure you've found that already.

I'm mid book writing and it's really eating every spare moment.

I needed a situation where the images were created via AddGridPages, but I wasn't using the grid, so I hid it this way:

AddGridPages {
template='fakeindex.html',
destination='resources',
rows=1,
columns=5',
}


AddPage {
template='head.html',
filename='index.html',
}
AddPage {
template='images.html',
filename='images.xml',
}

Also, I really need to read back over stuff here to work through it, but I'm really way too busy..
Did you get much traffic from the blog post?
 
Okay...

The file generated by AddGridPages is always index.html. You need to have one of these pages to generate the files AFAIK, but by putting it in a subdirectory, like I have with resources, you can use AddPage to create a new page called index.html in the top level folder.
Now it's 4:3'am here, so I'm pretty tired, so you'll have to start explaining what you need from there!
 
Sean,

Thank you very much for replying. I'm sure even with the Atlantic between us there are times we should both be sleeping but are awake!

I did get good traffic from the blog post. Thanks for that as well!

I'm getting there. One idea I am using is to put the custom pages into a subdirectory of their own so that the index.html is not a problem. I'm getting closer. When I get the solution I want I'll post it.

Good luck with the writing!
 
It's on hold currently with the Lightroom book, but I'm half way through a book on creating web galleries. Now Matthew is more an expert, but I still have 9'% of stuff covered already, I just need to add some bits relating to Flash galleries, conditional stuff and additional pages.

You probably already know most of it from bashing about.
 
[quote author=Sean McCormack link=topic=2'''.msg14759#msg14759 date=1211684626]
...

I needed a situation where the images were created via AddGridPages, but I wasn't using the grid, so I hid it this way:

AddGridPages {
template='fakeindex.html',
destination='resources',
rows=1,
columns=5',
}

....
[/quote]


Did that really work Sean? I am getting this demangling error. I could understand this, as now there will be no index file in the root and there's where lr is looking for. Ayayay
 
Thank you Sean,

I did it using the simple code of one of your tutorials. What I changed is the addgrid (ass in the examples) statement to force the index into 'resources'.
Anyway, I am trying to understand SDK 2.2, but it is not essential because as an alternative I can use the export module to place pictures exactly where I want.
 
Your not obliged to use AddGridPages, I just use AddPage in my plugins.
To generate files you can use
&lt;% for i=1, numImages do %&gt; &lt;img src="&lt;%= getImage(i).exportFilename %&gt;.jpg" /&gt;&lt;% end %&gt;
 
Status
Not open for further replies.
Back
Top