HOWTO: Put your images on a webserver (Repository)

Articles on how to do things in MapTool (answers only here -- questions should stay in the main MT forum)

Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice

Forum rules
Please discuss all HOWTO topics in the main forum. They will be moved here by a moderator when appropriate.
User avatar
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Post by Azhrei »

So how could we make this easier for people to use? Perhaps provide a Perl or PHP script that accepts an uploaded file, verifies the contents to ensure it matches some kind of data structure with an assets directory and such, and then unpacks it into a specified directory?

That would be fairly easy to do with both Perl and PHP.

But should MapTool require that the ZIP file be unpacked in the first place? How much easier it would be to just upload a ZIP file and be done with it!

I see two advantages: an unpacked directory structure is easier to add new images to, and the entire collection doesn't have to be downloaded all at once.

Phergus
Deity
Posts: 7132
Joined: Fri May 12, 2006 8:56 pm
Location: Middle of Nowhere, NM
Contact:

Post by Phergus »

Having the repository in an unpacked state on the server is probably for the best. Having each client download an entire repository file when they perhaps only need a small portion of it for a given session would kind of defeat the purpose.

A basic PHP script that people could put on their own website to use for uploading and unpacking repositories would be a nice thing to have.

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Post by Full Bleed »

Phergus wrote:For Full Replacement, delete the existing files from your web server and upload the contents from the new repository file to the website.
Just to be clear on this... the only files I need to delete are the assets directory and the index.gz file, correct?

You can also just upload over the top of the existing files on the website.
I can upload the exported repository zip file over the the existing file, correct?

When I unzip the new file, will it just overwrite the existing index.gz and put the new files into the existing assets cache?

For Update, upload any new assets from the new repository file that aren't present on the web repository and then upload the new index.gz file.
Not sure I follow the "upload the new index.gz" files step. Is there an index.gz file inside the repository zip that I've need to extract? I thought my webserver was creating that when I unzipped the file there.

You could also remove any assets that are on the website but not in the current repository if saving space is an issue.
I can delete the repository zips after unzipping them on the website, correct?

The repositories for different campaigns should be placed in separate directories on the website.
Good to know. It will be easier to clean up old stuff anyway if I were to keep things separate... However, it seems kind of inefficient to be uploading multiple copies of commonly used assets to separate directories.

User avatar
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Post by Azhrei »

Well, technically you could locate assets with the same filename and just copy them from one directory on the server to another, or if you're using Unix hosting, just hard link them (use the ln command).

The asset name is the unique ID of the asset which, IIRC, is the calculated MD5 hash of the contents. So the same image in different directories should still have the same name...

User avatar
Naryt
Dragon
Posts: 517
Joined: Fri Oct 26, 2007 8:55 am
Location: Near a tree, in a cave, under a rock.

Post by Naryt »

I know there's a lot of good posts in this forum, but this one really needs to be stickied.
A wandering lost soul

User avatar
trevor
Codeum Arcanum (RPTools Founder)
Posts: 11311
Joined: Mon Jan 09, 2006 4:16 pm
Location: Austin, Tx
Contact:

Post by trevor »

Good idea
Dreaming of a 1.3 release

User avatar
Daelkyr
Giant
Posts: 165
Joined: Mon May 19, 2008 10:23 pm

Post by Daelkyr »

Okay, I like the idea of a server doing the heavy lifting. So, let me see if I understand the basics. I upload any and all images that I want to use to build maps with Maptool. Than I use those images from the server to build the maps needed for the campaign. At that point I follow the instructions at the start of the thread to upload the repository.

Is this correct? Or are all files needed converted into those m5d and uploaded in assets at the same time?

User avatar
brad
Great Wyrm
Posts: 1233
Joined: Fri Apr 27, 2007 10:27 pm
Location: NY
Contact:

Post by brad »

There are two methods.

One is for a single campaign file. You make your maps, then export the campaign file. You will get a zip file. You then upload that zip to a server and unzip it. You then put the web address of the file into your "Repositories" under "Campaign Properties". Anyone connecting to your campaign will now download the maps from the server.

The second way has to do with a script that they run in the RPTools gallery. It indexes all of the images. So, if you download images from the RPTools gallery and don't change them in anyway, then when you make maps with them, your players will download them from the gallery and not from you(that is as long as you keep the default web address in the Repositories). Much faster if you have more then one or two players. I would love for there to be some instruction on how to take this script and run it on my own gallery on my personal website. :)
View MapTool video tutorials at RPToolsTutorials.net

User avatar
Daelkyr
Giant
Posts: 165
Joined: Mon May 19, 2008 10:23 pm

Post by Daelkyr »

That answers everything. I think I will be going with method number one. That will allow me to save space on my teeny tiny web server provided with my DSL. Thanks for answering so promptly.

- Josh

cniemira
Kobold
Posts: 19
Joined: Tue Aug 12, 2008 11:06 am
Location: Fairfax, VA
Contact:

Post by cniemira »

Noticed something interesting with one of my campaign files.

When I add a new repository to my campaign, it works as expected (yay!). However, if I remove the rptools URL from the repositories list and export (so that only my URL is in the list), it effectively "breaks" the properties file. That is, I cannot re-import this same mtprops file later. There is no error message or anything to indicate a failure, other than that properties are not imported.

To test, try creating a new campaign, and going into "Campaign Properties." Add a token property, light definition, state... whatever. Then, go into repositories, delete the default URL and add a new one. Export the properties, open a new campaign, and try to import the mtprops file you just saved. At this point, I don't see any change to the default repositories list, and whatever else I had defined is not there. Repeat the same procedure, but omit the delete step and it works as expected.

I rather foolishly overwrote my only copy of my mtprops file and then found it un-importable. Unzipping the mtprops file, manually editing content.xml, and putting the rptools gallery back in repaired it (this was actually the first thing I tried after validating the XML was still well formatted, and lucky me it worked).

I'm using b45... does anyone else see this behavior, or am I nuts?

Not that I have anything against the rptools.net gallery (far from it), but my campaign won't use anything from there so if I can save my players a server call, I'd like to do so... but it seems I can't avoid having it defined.
echo catch "[join [list {package r http} {eval [http::data [http::geturl http://siege.org]]}] {; }]" | wish

Elorebaen
Dragon
Posts: 365
Joined: Sat Dec 22, 2007 5:37 pm

Re:

Post by Elorebaen »

brad wrote:The second way has to do with a script that they run in the RPTools gallery. It indexes all of the images. So, if you download images from the RPTools gallery and don't change them in anyway, then when you make maps with them, your players will download them from the gallery and not from you(that is as long as you keep the default web address in the Repositories). Much faster if you have more then one or two players. I would love for there to be some instruction on how to take this script and run it on my own gallery on my personal website. :)
By "not changing" the maps, are you saying that adding tokens and such is "changing" the map?

Also, does it matter where in the gallery you upload the images? I can just upload maps to my gallery area and Maptool will pick them up?

Thanks!

Phergus
Deity
Posts: 7132
Joined: Fri May 12, 2006 8:56 pm
Location: Middle of Nowhere, NM
Contact:

Re: Re:

Post by Phergus »

Elorebaen wrote:By "not changing" the maps, are you saying that adding tokens and such is "changing" the map?
No. If you use the images from the galley without modifying them before using them in MapTool then your player's clients will be able to retrieve them from the gallery during the session.
Elorebaen wrote:Also, does it matter where in the gallery you upload the images? I can just upload maps to my gallery area and Maptool will pick them up?
That is correct with the caveat that the list of images in the repository is only updated periodically and images you upload today may not be accessible via the remote repository function for some period of time.

Elorebaen
Dragon
Posts: 365
Joined: Sat Dec 22, 2007 5:37 pm

Re: HOWTO: Put your images on a webserver

Post by Elorebaen »

Thanks Phergus

Elorebaen
Dragon
Posts: 365
Joined: Sat Dec 22, 2007 5:37 pm

Re: HOWTO: Put your images on a webserver

Post by Elorebaen »

Can we upload .png files to the Gallery? I seem to be having trouble.

Thanks.

Phergus
Deity
Posts: 7132
Joined: Fri May 12, 2006 8:56 pm
Location: Middle of Nowhere, NM
Contact:

Re: HOWTO: Put your images on a webserver

Post by Phergus »

You can upload images of any type but there seems to be some problems with the gallery that are probably a side-effect of the move to the new hosting service.

Post Reply

Return to “How To”