PDA

View Full Version : Simple JavaScript Request (hopefully)


Doug Munn - JLM PHOTO
Nov-29-2005, 11:16 AM
Copied from the code of an image page in one of my albums.

<script type="text/javascript">
guestPage = true; galleryStyle = 'smugmug';
AlbumID = '857344';
ImageID = '38854816';
webServer = 'http://jerrimunnphoto.smugmug.com';
commentLink = "http://jerrimunnphoto.smugmug.com/gallery/857344/1/38854816/Medium#comment (http://jerrimunnphoto.smugmug.com/gallery/857344/1/38854816/Medium#comment)";
</script>

It is nice that I can get some parameters like Album and Image ID through JavaScript. What would it take to also get the filename? Say as FileID or Filename?

Perhaps this could be turned off through customization for those who don't want it. Having my filename accessable so that I can use it for backlinks would be great.

I know that programming somethimg is never as simple as it seems, but hopefully this can be simpler than most requests.

I'd also like to know if others think that this would be useful.

Doug


Thanks for your continuing improvements.

jfriend
Nov-29-2005, 04:33 PM
Copied from the code of an image page in one of my albums.

<script type="text/javascript">
guestPage = true; galleryStyle = 'smugmug';
AlbumID = '857344';
ImageID = '38854816';
webServer = 'http://jerrimunnphoto.smugmug.com';
commentLink = "http://jerrimunnphoto.smugmug.com/gallery/857344/1/38854816/Medium#comment (http://jerrimunnphoto.smugmug.com/gallery/857344/1/38854816/Medium#comment)";
</script>

It is nice that I can get some parameters like Album and Image ID through JavaScript. What would it take to also get the filename? Say as FileID or Filename?

Perhaps this could be turned off through customization for those who don't want it. Having my filename accessable so that I can use it for backlinks would be great.

I know that programming somethimg is never as simple as it seems, but hopefully this can be simpler than most requests.

I'd also like to know if others think that this would be useful.

Doug


Thanks for your continuing improvements.I don't really understand what you are trying to do. Once you have the imageID and the base path of your site, you can construct an URL to any size of that particular image fairly easily (with no other info) just by appending the right suffix onto it. I'd show you some examples from your own gallery except you have image protection on in your gallery and that makes it take way too much time for me to create examples from your site. Instead, here's an example from my site:

Image in my gallery:
http://jfriend.smugmug.com/gallery/895410/1/40830056.
ImageID = "40830056".

Direct link to the medium-sized image:
http://jfriend.smugmug.com/photos/40830056-M.jpg

Direct link to the large-sized image:
I don't really understand what you are trying to do. Once you have the imageID and the base path of your site, you can construct an URL to any size of that particular image fairly easily (with no other info) just by appending the right suffix onto it. I'd show you some examples from your own gallery except you have image protection on in your gallery and that makes it take way too much time for me to create examples from your site. Instead, here's an example from my site:

Image in my gallery:
http://jfriend.smugmug.com/gallery/895410/1/40830056.
ImageID = "40830056".

Direct link to the medium-sized image:
http://jfriend.smugmug.com/photos/40830056-M.jpg

Direct link to one size of the thumb:
http://jfriend.smugmug.com/photos/40830056-L.jpg

You can create other sizes by simply appending other suffices after the ImageID. -L for large, -O for original, -S for small, -Th for a different sized thumb. Note: I don't allow viewing of the original size in this gallery so you won't be able to see that particular one in this gallery.

flyingdutchie
Nov-29-2005, 06:55 PM
Copied from the code of an image page in one of my albums.

<script type="text/javascript">
guestPage = true; galleryStyle = 'smugmug';
AlbumID = '857344';
ImageID = '38854816';
webServer = 'http://jerrimunnphoto.smugmug.com';
commentLink = "http://jerrimunnphoto.smugmug.com/gallery/857344/1/38854816/Medium#comment (http://jerrimunnphoto.smugmug.com/gallery/857344/1/38854816/Medium#comment)";
</script>

It is nice that I can get some parameters like Album and Image ID through JavaScript. What would it take to also get the filename? Say as FileID or Filename?

Perhaps this could be turned off through customization for those who don't want it. Having my filename accessable so that I can use it for backlinks would be great.

I know that programming somethimg is never as simple as it seems, but hopefully this can be simpler than most requests.

I'd also like to know if others think that this would be useful.

Doug


Thanks for your continuing improvements.You can not get at the original filename as it existed on your computer, before you upload it.
However, you can synthesize the URL to the image on the server, using the ImageID. Assuming the base-url is the URL to your webServer, then these two would work:

var imgSize = "Th"; // "Ti", "S", "M", "L" or "O" are the other sizes.
urlToImage = webServer+"/photos/"+ImageID+"-"+imgSize+".jpg";

or, because "/" goes to the root of your web-site anyway:

var imgSize = "Th"; // "Ti", "S", "M", "L" or "O" are the other sizes.
urlToImage = "/photos/"+ImageID+"-"+imgSize+".jpg";

But i don't know if these javascript variables are available on every gallery-style (besides smugmug or smugmug_small).

Mike Lane
Nov-29-2005, 07:56 PM
You can not get at the original filename as it existed on your computer, before you upload it.
What if you have filenames turned on for the gallery?

Doug Munn - JLM PHOTO
Nov-30-2005, 06:24 AM
I have a rather longwinded explanation in the thread at http://www.dgrin.com/showthread.php?t=23144&page=2&pp=10

The bottom line is that I can get the imageID now with no problem, and I can use it to generate imagelinks to view pictures.

The problem is that I want to also send back the filename in my backlink so that the filename appears on my custom product pages as reference or to use within our shopping cart on our site.

If a person takes a back link to our site and wants to purchase a particular package of pictures, or custom calendar or ...... we don't want them to call or order with the SmugMug imageID, we then have to look up the picture on SmugMug to get the filename. I'd just like to have the filename returned.

IT can be done through the API, but I don't have the smarts to do an XML query and processing in PHP. That's why I'd like to see the filename exposed as a JavaScript variable, the same as the album or imageID are.

That's all.

Make more sense now?

(Guess this explanation isn't as short winded as I tho't.) Sorry.

Doug

jfriend
Nov-30-2005, 07:14 AM
I have a rather longwinded explanation in the thread at http://www.dgrin.com/showthread.php?t=23144&page=2&pp=10

The bottom line is that I can get the imageID now with no problem, and I can use it to generate imagelinks to view pictures.

The problem is that I want to also send back the filename in my backlink so that the filename appears on my custom product pages as reference or to use within our shopping cart on our site.

If a person takes a back link to our site and wants to purchase a particular package of pictures, or custom calendar or ...... we don't want them to call or order with the SmugMug imageID, we then have to look up the picture on SmugMug to get the filename. I'd just like to have the filename returned.

IT can be done through the API, but I don't have the smarts to do an XML query and processing in PHP. That's why I'd like to see the filename exposed as a JavaScript variable, the same as the album or imageID are.

That's all.

Make more sense now?

(Guess this explanation isn't as short winded as I tho't.) Sorry.

DougI offered one idea in this other thread (http://www.dgrin.com/showthread.php?t=23144&page=2) before I saw this thread.

Doug Munn - JLM PHOTO
Dec-01-2005, 06:46 AM
I offered one idea in this other thread (http://www.dgrin.com/showthread.php?t=23144&page=2) before I saw this thread.
That was the same issue.

Thanks for the pointer.