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: Azhrei, dorpond, trevor, 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
Full Bleed
Demigod
Posts: 4444
Joined: Sun Feb 25, 2007 11:53 am
Location: MD
Contact:

Re: HOWTO: Put your images on a webserver

Post by Full Bleed »

Azhrei wrote:I think I misunderstood your question.


Well, my wish-list on this feature probably isn't simple, but I think it would make it a hell of a lot more useful. I've only used this feature once, and after doing it decided it wasn't worth the trouble to use ever again. Players can wait till the transfers are done the "slow way" as far as I'm concerned.

However, if I could enter my FTP info once... then from there on out single click sending campaigns and assets to the FTP I think it would be really useful. Particularly if when looking at my campaign assets if I could see, at a glance what was in the repository and what wasn't.

So, say I put the campaign on a repository. Then I work on it some more... we play a session and then I update it for the next game. If I could look at what's in the campaign and easily see, "Hey, I should probably put that map, those 5 new trees, and those 3 new buildings in the repository." And then actually be able to do it by selecting the assets and clicking "send to repository"... that would be awesome.

I'd actually use the feature and the group would gain the benefit. But as it is now, I find this to be a pretty clunky implementation.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

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

Re: HOWTO: Put your images on a webserver

Post by Azhrei »

I've started a new thread under Feature Requests. Take a look and tell me what you think.

User avatar
IMarvinTPA
Dragon
Posts: 467
Joined: Mon Sep 11, 2006 10:12 am
Contact:

Re: HOWTO: Put your images on a webserver

Post by IMarvinTPA »

IMarvinTPA wrote:I haven't had time to verify that all the files have been uploaded, nor if it works as intended yet, but the upload is reportedly complete. I'll verify when I have some time.

http://www.imarvintpa.com/Mapping/index.gz



This URL should work now. I found I had a permissions issue on this file alone. You can also freely navigate the directories in http://www.imarvintpa.com/Mapping/

I'm still trying to figure out how to tell the difference between getting a file from the host and from this site as a test, but, I think it works in theory now.

IMarv

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

Re: HOWTO: Put your images on a webserver

Post by Azhrei »

IMarvinTPA wrote:I'm still trying to figure out how to tell the difference between getting a file from the host and from this site as a test, but, I think it works in theory now.

IMarv

If everything is working correctly, you can't.

But that's the point, isn't it? And because the image is only retrieved once and then cache after that, you would only see the network traffic on the first attempt to use an image that wasn't in the cache.

However, if you wanted to force it ... start MapTool as usual, drag an image to the map, determine it's asset ID (via something like getSelectedTokens() or similar), and then shutdown MapTool. Do not save the campaign. Now go to your .maptool/assetcache folder and delete the asset that you recorded earlier. Then next time you try to use that same image, it will have to be loaded externally since it won't be found in the cache.

User avatar
IMarvinTPA
Dragon
Posts: 467
Joined: Mon Sep 11, 2006 10:12 am
Contact:

Re: HOWTO: Put your images on a webserver

Post by IMarvinTPA »

The output of md5sum is almost what MapTool uses. However, I do not know if the fact that md5sum (at least the version on my webhost) which outputs 2 spaces between the MD5 and the path to the file is an issue for MapTool.

Does anybody know if

Code: Select all

md5sum "somdir" >index
gzip index

produces results that are acceptable to MapTool?

(I need to check to see if it is in fact a tab or two spaces.)

Edit:
1) It is 2 spaces.
2) The code "Trims" the URL path for the file. (So don't name any files with spaces at the end! Or directories with spaces at the front...)

Answer: Yes, md5sum's output is perfect for the index file.

IMarv

User avatar
IMarvinTPA
Dragon
Posts: 467
Joined: Mon Sep 11, 2006 10:12 am
Contact:

Re: HOWTO: Put your images on a webserver

Post by IMarvinTPA »

I thought this deserved its own post:

This command will seek out, compute, and generate the index needed for a repository. Run this from the folder you want the index.gz file for. Images may be in the same folder as the index.

Code: Select all

find * ! -type d "(" -iname "*.png" -o -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.rptok" -o -iname "*.bmp" ")" -print0 | xargs -0 md5sum | gzip > index.gz


If you need more file type extentions, just add them with -o -iname "*.ext" after the "*.bmp"

IMarv

Edit: Added rptok and fixed a typo in the text.

Edit 2:
If you don't care about filtering the file name (in the event you have an assets folder with no file name extensions):

Code: Select all

find * ! -type d -print0 | xargs -0 md5sum | gzip > index.gz
Last edited by IMarvinTPA on Thu Feb 26, 2009 5:25 pm, edited 2 times in total.

User avatar
RPTroll
TheBard
Posts: 3148
Joined: Tue Mar 21, 2006 7:26 pm
Location: Austin, Tx
Contact:

Re: HOWTO: Put your images on a webserver

Post by RPTroll »

IMarvinTPA wrote:I thought this deserved its own post:

This command will seek out, compute, and generate the index needed for an repository. Run this from the folder you want the index.gz file for. Images may be in the same folder as the index.

Code: Select all

find * ! -type d "(" -iname "*.png" -o -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.bmp" ")" -print0 | xargs -0 md5sum | gzip > index.gz


If you need more file type extentions, just add them with -o -iname "*.ext" after the "*.bmp"

IMarv


I can't say thank you enough. That's outstanding.
ImageImage ImageImageImageImage
Support RPTools by shopping
Image
Image

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

Re: HOWTO: Put your images on a webserver

Post by Azhrei »

It does assume that you're using the standard filename extensions for images. That's probably pretty reasonable. If you're not using filename extensions for some reason (as he mentioned, maybe because you're scanning an asset directory). Change directory to the top level where you want to begin the search, then use the following (all one line):

Code: Select all

find . -type f -print0 | xargs -0 file | grep -ie png -e exif -e jfif -e jpeg -e jpg | cut -d: -f1 | xargs md5sum | gzip -9 > index.gz

The parameters passed to grep might need to be modified if your version of the file command uses different output strings for those file types.

(I just love the Un*x shell. Can you tell? ;))

User avatar
IMarvinTPA
Dragon
Posts: 467
Joined: Mon Sep 11, 2006 10:12 am
Contact:

Re: HOWTO: Put your images on a webserver

Post by IMarvinTPA »

Azhrei wrote:

Code: Select all

find . -type f -print0 | xargs -0 file | grep -ie png -e exif -e jfif -e jpeg -e jpg | cut -d: -f1 | xargs md5sum | gzip -9 > index.gz



That's the command I wanted back at about this post: viewtopic.php?p=81821#p81821

The repository includes a few .rptok files, I wonder if those work since they contain images... Hmm.

IMarv

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

Re: HOWTO: Put your images on a webserver

Post by Azhrei »

(Moved to the MapTool -> HOWTO forum so that I could also leave a "shadow" topic in the original location. They are both the same thread and updates in one will appear in the other.)

Post Reply

Return to “How To”