View Full Version : Random banner shots?
rutt
May-08-2005, 06:03 AM
Suppose I want my gallery to have a couple or three shots in it's header chosen at random from some larger set. Just like dgrin and smugmug do. How do I accomplish this? Can I?
DJ-S1
May-08-2005, 06:26 AM
:ear
Just upgraded my account and I'm dying to do this too!
{JT}
May-08-2005, 08:43 PM
If you look at the source code for Dgrin you will see the javascript code that does all of the work, it is fairly straight forward.
DJ-S1
May-09-2005, 06:57 AM
<!--
var authLl = new Array();
var authP = new Array();
var authLr = new Array();
// authors for Ll folder, array count matches image filename
authLl[0]="Mitchell";
authLl[1]="Shakey";
authLl[2]="pete";
authLl[3]="trish";
authLl[4]="Danny";
authLl[5]="Andy";
authLl[6]="Adrian";
authLl[7]="damon";
authLl[8]="skippy";
// authors for P folder, array count matches image filename
authP[0]="Ginger";
authP[1]="Harry";
authP[2]="snapapple";
authP[3]="purified";
authP[4]="fish";
authP[5]="Gus";
authP[6]="edhughes";
authP[7]="gubbs";
// authors for Lr folder, array count matches image filename
authLr[0]="4labs";
authLr[1]="Lynn";
authLr[2]="mitchell";
authLr[3]="windoze";
authLr[4]="stan";
authLr[5]="david cothran";
authLr[6]="KevinKal";
authLr[7]="Lynnma";
authLr[8]="rutt";
authLr[9]="stevecav";
//-->
</script>
<!-- logo -->
<STYLE TYPE="text/css" MEDIA=screen>
.smborder {
border-style: solid;
border-width: 1px;
border-color: #777777; }
</STYLE>
<div align="center">
<table border="0" width="731" cellpadding="0" cellspacing="0">
<tr>
<td width="188">
<a href="/index.php">
<img src="/images/misc/BannerLeftBlack.gif" width="176" height="105" border="0" hspace="6" vspace="0" alt="Digital Grin">
</a>
</td>
<td width="158">
<script type="text/javascript">
Ll = Math.floor(Math.random()*authLl.length);
document.write('<img width="148" height="103" hspace="4" vspace="0" class="smborder"');
document.write(' src="/images/banner/Ll/'+Ll+'.jpg"');
document.write(' alt="'+authLl[Ll]+'"');
document.write(' alt="'+authLl[Ll]+'"');
document.write(' />');
</script>
<noscript>
<img src="/images/banner/Ll/0.jpg" width="148" height="103" hspace="4" vspace="0" class="smborder" alt="Mitchell" title="Mitchell" />
</noscript>
</td>
<td width="90">
<script type="text/javascript">
P = Math.floor(Math.random()*authP.length);
document.write('<img width="82" height="103" hspace="4" vspace="0" class="smborder"');
document.write(' src="/images/banner/P/'+P+'.jpg"');
document.write(' alt="'+authP[P]+'"');
document.write(' alt="'+authP[P]+'"');
document.write(' />');
</script>
<noscript>
<img src="/images/banner/P/0.jpg" width="82" height="103" hspace="4" vspace="0" class="smborder" alt="Ginger" title="Ginger" />
</noscript>
</td>
<td width="158">
<script type="text/javascript">
Lr = Math.floor(Math.random()*authLr.length);
document.write('<img width="148" height="103" hspace="4" vspace="0" class="smborder"');
document.write(' src="/images/banner/Lr/'+Lr+'.jpg"');
document.write(' alt="'+authLr[Lr]+'"');
document.write(' alt="'+authLr[Lr]+'"');
document.write(' />');
</script>
<noscript>
<img src="/images/banner/Lr/0.jpg" width="148" height="103" hspace="4" vspace="0" class="smborder" alt="4labs" title="4labs" />
</noscript>
</td>
<td>
<a href="http://www.smugmug.com (http://www.smugmug.com/)">
<img src="/images/misc/BannerRightBlack.gif" width="129" height="105" border="0" hspace="0" vspace="0" alt="smugmug.com" />
</a>
</td>
</tr>
</table>
</div>
<!-- /logo -->You mean this part? :scratch Yup, pretty straightforward... :lol3
So I take it you made 3 arrays, one each for the left, middle and right image. Then you name the images left1, left2, etc and the script randomly chooses the number to tack on the end of the name, and does some other magic as well. I'm not sure I could do this, since I can't control the naming of the images?
rutt
May-09-2005, 08:24 AM
I reverse engineered this from the dgrin headers. My take is a little more readable, I think.
In the script field of the customize page, I have:
var Ll = new Array();
Ll[0] = "http://rutt.smugmug.com/photos/20842723-Ti.jpg";
Ll[1] = "http://rutt.smugmug.com/photos/21539361-Ti.jpg";
Ll[2] = "http://rutt.smugmug.com/photos/12248309-Ti.jpg";
Ll[3] = "http://rutt.smugmug.com/photos/21541053-Ti.jpg";
Ll[4] = "http://rutt.smugmug.com/photos/21541086-Ti.jpg";
var P = new Array();
P[0] = "http://rutt.smugmug.com/photos/21541448-Ti.jpg";
P[1] = "http://rutt.smugmug.com/photos/21541604-Ti.jpg";
var Lr = new Array();
Lr[0] = "http://rutt.smugmug.com/photos/21566240-Ti.jpg";
Lr[1] = "http://rutt.smugmug.com/photos/21566271-Ti.jpg";
Lr[2] = "http://rutt.smugmug.com/photos/21566326-Ti.jpg";
function choosePhoto(parray)
{
inx = Math.floor(Math.random()*parray.length);
img = parray[inx];
document.write('<img border="2" src="' + img + '"/>');
}
This defines the javascript function choosePhoto which takes an array of image URLs as argument. It chooses one from the array at random and writes an img tag for it to the document with a 2 pixel border.
This can be then used in the header code. The simplest use would be something like:
<script type="text/javascript">choosePhoto(Ll);</script>
which just picks one of the L1 images and puts in in the banner.
Something more like the dgrin header can be accomplished by reusing this in a table. I now have this in my header field:
<center>
<table cellpadding="0" cellspacing="10">
<tr align=center valign=middle>
<td align=left width=300>
<img src="http://rutt.smugmug.com/photos/21631873-O.jpg">
</td>
<td>
<script type="text/javascript">
choosePhoto(Ll);
</script>
<noscript>
<img src="http://rutt.smugmug.com/photos/20842723-Ti.jpg"/>
</noscript>
</td>
<td>
<script type="text/javascript">
choosePhoto(P);
</script>
<noscript>
<img src="http://rutt.smugmug.com/photos/21541448-Ti.jpg">
</noscript>
</td>
<td>
<script type="text/javascript">
choosePhoto(Lr);
</script>
<noscript>
<img src="http://rutt.smugmug.com/photos/21566240-Ti.jpg">
</noscript>
</td>
<td width=300/>
</tr>
</table>
</center>
I think something a lot nicer could be done if I knew how to use the API from javascript. Then it would be possible to use a gallery as argument to the choosePhoto function and it would choose a random image from the gallery. That the header code wouldn't have to change to add/remove images from the base of images for random selection.
DoctorIt
May-09-2005, 08:28 AM
this is cool! thanks rutt, I'll have to pirate that...
DJ-S1
May-09-2005, 08:36 AM
:agree :nod Thanks!
Andy
May-09-2005, 08:37 AM
where do you grab your photos from? any gallery? do you resize the shots? i've found that some shots work better than others at the tiny size...
rutt
May-09-2005, 08:43 AM
There was a bug in the code I posted. Actually, it wasn't exactly my bug. In the chooseImage function I indexed the array parray with the variable i. It turns out that this is a vbulletin tag, the one that starts italics, and so it got eaten. I've fixed by changing the name of the variable. The code in my post should now work.
OK, guys, how to I post the string open-bracket i close-bracket?
rutt
May-09-2005, 08:51 AM
where do you grab your photos from? any gallery? do you resize the shots? i've found that some shots work better than others at the tiny size...
This is a good point. I'm still in the development stage here. I'm glad to have made the code work and have just started to try to make things look good. I don't think smugmug thumbnails are quite large enough. They can be resized by the html code, but the resolution won't be perfect. (Might not matter.)
I'm thinking I'll do the following:
Keep a local directory for each of the image slots
Use ImageMagick to resize all the images in each directory to the right size (whatever that is.)
Use my python script sm_tool.py keep smugmug mirrors of each local directory.
Enhance sm_tool.py to generate lists of the URLs for the iamges in each of these galleries
Write a little script to transform these lists into array initializations for inclusion in the script field of the Customize form.
As you can see, I'm still working on the mechanism and not the actual look of the thing. That's always my problem.
{JT}
May-09-2005, 09:05 AM
The code could be even simpler if you just did a .src swap with an image on the body load. The main reason I implemented all of those document.write's for each image was that some people here were having a problem not seeing the mini-banners. It was a failed attempt though, but I just never went back to fix it :)
rutt
May-09-2005, 09:08 AM
The code could be even simpler if you just did a .src swap with an image on the body load. The main reason I implemented all of those document.write's for each image was that some people here were having a problem not seeing the mini-banners. It was a failed attempt though, but I just never went back to fix it :)
Please elaborate.
Maki
May-10-2005, 12:04 AM
Something more like the dgrin header can be accomplished by reusing this in a table. I now have this in my header field:
<center>
<table cellpadding="0" cellspacing="10">
<tr align=center valign=middle>
<td align=left width=300>
<img src="http://rutt.smugmug.com/photos/21631873-O.jpg">
</td>
<td>
<script type="text/javascript">
choosePhoto(Ll);
</script>
<noscript>
<img src="http://rutt.smugmug.com/photos/20842723-Ti.jpg"/>
</noscript>
</td>
<td>
<script type="text/javascript">
choosePhoto(P);
</script>
<noscript>
<img src="http://rutt.smugmug.com/photos/21541448-Ti.jpg">
</noscript>
</td>
<td>
<script type="text/javascript">
choosePhoto(Lr);
</script>
<noscript>
<img src="http://rutt.smugmug.com/photos/21566240-Ti.jpg">
</noscript>
</td>
<td width=300/>
</tr>
</table>
</center>
I think something a lot nicer could be done if I knew how to use the API from javascript. Then it would be possible to use a gallery as argument to the choosePhoto function and it would choose a random image from the gallery. That the header code wouldn't have to change to add/remove images from the base of images for random selection.
aaaaaahhhh... please forgive my ignorance... I believe I understand most of it, but I can't seem to get why you have img src tags in the section above? I see that the first one is for a non-rotating image, but what are the others for?
winnjewett
May-10-2005, 12:42 AM
OK, guys, how to I post the string open-bracket i close-bracket? Here goes:
[i]This text isn't in italics[/i]
I did this by substituting '[' and 'c' for '[' and ']' respectively.
hth,
-winn
rutt
May-10-2005, 04:59 AM
aaaaaahhhh... please forgive my ignorance... I believe I understand most of it, but I can't seem to get why you have img src tags in the section above? I see that the first one is for a non-rotating image, but what are the others for?
The sections that say "noscript" appear in browsers that don't support scripting. So they are sort of lame alternatives to the random banners.
Maki
May-11-2005, 12:33 AM
The sections that say "noscript" appear in browsers that don't support scripting. So they are sort of lame alternatives to the random banners.
Ah... Incidentally, just checked what my page is doing in IE and I see that occasionally I'm getting the red x (fine on firefox). It's random though... any thoughts on these? oh wait... I think I figured it out.
It appears that IE doesn't like pulling direct links from password protected galleries. I got lazy and didn't pull all pictures into my banner gallery.
All is well now. Thanks!
aciurczak
Jun-08-2005, 08:18 AM
I modified the function a bit so the small pictures would be clickable, and would bring up the large pictures on a separate page. You need to remove the size at the end of the image names in the array above, so when you add "Th.jpg" on it the file name is correct..
function choosePhoto(parray)
{
inx = Math.floor(Math.random()*parray.length);
img = parray[inx] + "Th.jpg";
img2= parray[inx]+"L.jpg";
document.write('<a href="' + img2 + '"><img border="0" src="' + img + '" height="113" />');
}
sheriffvedder@mac.com
Mar-09-2006, 08:56 PM
I modified the function a bit so the small pictures would be clickable, and would bring up the large pictures on a separate page. You need to remove the size at the end of the image names in the array above, so when you add "Th.jpg" on it the file name is correct..
function choosePhoto(parray)
{
inx = Math.floor(Math.random()*parray.length);
img = parray[inx] + "Th.jpg";
img2= parray[inx]+"L.jpg";
document.write('<a href="' + img2 + '"><img border="0" src="' + img + '" height="113" />');
}
ok, forgive me for being a newb but, is there a way to get these to link to the gallery the photo is from and not just the image? Also I'm having a hard time getting it to center on the site, any help would be great!
Da Sheriff
aciurczak
Mar-09-2006, 09:47 PM
Anythings possible, but it would require quite different code. You'd need to have a different array, or two separate arrays; one with the file location of the picture, and one with the file location of the gallery you'd want to load. Centering isn't due to the function call; that's all going to work or not work based on where you call that function from.
Dalantech
Aug-20-2006, 01:50 AM
I reverse engineered this from the dgrin headers. My take is a little more readable, I think.
Thanks Rutt -those instructions were very easy to use! I've already got mine going -I just need to iron out some minor layout issues with the rest of the site :): http://dalantech.smugmug.com/
i am having probs making this work. i can only get one pic to show in the header????????
I reverse engineered this from the dgrin headers. My take is a little more readable, I think.
In the script field of the customize page, I have:
var Ll = new Array();
Ll[0] = "http://rutt.smugmug.com/photos/20842723-Ti.jpg";
Ll[1] = "http://rutt.smugmug.com/photos/21539361-Ti.jpg";
Ll[2] = "http://rutt.smugmug.com/photos/12248309-Ti.jpg";
Ll[3] = "http://rutt.smugmug.com/photos/21541053-Ti.jpg";
Ll[4] = "http://rutt.smugmug.com/photos/21541086-Ti.jpg";
var P = new Array();
P[0] = "http://rutt.smugmug.com/photos/21541448-Ti.jpg";
P[1] = "http://rutt.smugmug.com/photos/21541604-Ti.jpg";
var Lr = new Array();
Lr[0] = "http://rutt.smugmug.com/photos/21566240-Ti.jpg";
Lr[1] = "http://rutt.smugmug.com/photos/21566271-Ti.jpg";
Lr[2] = "http://rutt.smugmug.com/photos/21566326-Ti.jpg";
function choosePhoto(parray)
{
inx = Math.floor(Math.random()*parray.length);
img = parray[inx];
document.write('<img border="2" src="' + img + '"/>');
}
This defines the javascript function choosePhoto which takes an array of image URLs as argument. It chooses one from the array at random and writes an img tag for it to the document with a 2 pixel border.
This can be then used in the header code. The simplest use would be something like:
******** type="text/javascript">choosePhoto(Ll);</********
which just picks one of the L1 images and puts in in the banner.
Something more like the dgrin header can be accomplished by reusing this in a table. I now have this in my header field:
<center>
<table cellpadding="0" cellspacing="10">
<tr align=center valign=middle>
<td align=left width=300>
<img src="http://rutt.smugmug.com/photos/21631873-O.jpg">
</td>
<td>
******** type="text/javascript">
choosePhoto(Ll);
</********
<noscript>
<img src="http://rutt.smugmug.com/photos/20842723-Ti.jpg"/>
</noscript>
</td>
<td>
******** type="text/javascript">
choosePhoto(P);
</********
<noscript>
<img src="http://rutt.smugmug.com/photos/21541448-Ti.jpg">
</noscript>
</td>
<td>
******** type="text/javascript">
choosePhoto(Lr);
</********
<noscript>
<img src="http://rutt.smugmug.com/photos/21566240-Ti.jpg">
</noscript>
</td>
<td width=300/>
</tr>
</table>
</center>
I think something a lot nicer could be done if I knew how to use the API from javascript. Then it would be possible to use a gallery as argument to the choosePhoto function and it would choose a random image from the gallery. That the header code wouldn't have to change to add/remove images from the base of images for random selection.
Andy
Sep-16-2006, 11:49 AM
i am having probs making this work. i can only get one pic to show in the header????????
Hi, those that will help you, will need your smugmug site to see what's going on.
http://nickname.smugmug.com please :thumb
i am having probs making this work. i can only get one pic to show in the header????????
ok i got the pics to come up and then noticed that i had **** in place of script, not script, ect. in what i had in the header section-- replaced the *** with what you had and now i don't have any pics???????????
oh, and when i had pics to come up, they would not change
sorry i did not give you my addy soar.smugmug
Ok, thanks--i have written back to rutt. i think i am on the brink to making
this work.
can i make the click back to the homepage on the left of the header directly across from the pic's banner instead of below it?
Hi, those that will help you, will need your smugmug site to see what's going on.
http://nickname.smugmug.com please :thumb
i found out that i have to give you my addy in this format
http://soar.smugmug.com
i am having probs making this work. i can only get one pic to show in the header????????
i still have not heard from anyome on how to make the pics in my header
change????????????????
http://soar.smugmug.com
Hi, those that will help you, will need your smugmug site to see what's going on.
http://nickname.smugmug.com please :thumb
http://soar.smugmug.com
hey andy, i still have not got the banner pics to change. and, in the process
i have messed up the 4 across gallery thing??????????
Hi, those that will help you, will need your smugmug site to see what's going on.
http://nickname.smugmug.com please :thumb
Mike Lane
Sep-19-2006, 10:04 AM
:nono
This does not belong in your CSS
var Ll = new Array();
Ll[0] = "http://soar.smugmug.com/photos/96238290-M.jpg";
Ll[1] = "http://soar.smugmug.com/photos/96144414-M.jpg";
Ll[2] = "http://soar.smugmug.com/photos/96144375-M.jpg";
Ll[3] = "http://soar.smugmug.com/photos/96144368-M.jpg";
Ll[4] = "http://soar.smugmug.com/photos/96144394-M.jpg";
var P = new Array();
P[0] = "http://soar.smugmug.com/photos/96185803-M.jpg";
P[1] = "http://soar.smugmug.com/photos/96144368-M.jpg";
var Lr = new Array();
Lr[0] = "http://soar.smugmug.com/photos/96238228-M.jpg";
Lr[1] = "http://soar.smugmug.com/photos/96144370-M.jpg";
Lr[2] = "http://soar.smugmug.com/photos/96144401-M.jpg";
function choosePhoto(parray)
{
inx = Math.floor(Math.random()*parray.length);
img = parray[inx];
document.write('<img border="2" src="' + img + '"/>');
}
http://soar.smugmug.com
does it belong somewhere else??? what makes the pics change????
:nono
This does not belong in your CSS
var Ll = new Array();
Ll[0] = "http://soar.smugmug.com/photos/96238290-M.jpg";
Ll[1] = "http://soar.smugmug.com/photos/96144414-M.jpg";
Ll[2] = "http://soar.smugmug.com/photos/96144375-M.jpg";
Ll[3] = "http://soar.smugmug.com/photos/96144368-M.jpg";
Ll[4] = "http://soar.smugmug.com/photos/96144394-M.jpg";
var P = new Array();
P[0] = "http://soar.smugmug.com/photos/96185803-M.jpg";
P[1] = "http://soar.smugmug.com/photos/96144368-M.jpg";
var Lr = new Array();
Lr[0] = "http://soar.smugmug.com/photos/96238228-M.jpg";
Lr[1] = "http://soar.smugmug.com/photos/96144370-M.jpg";
Lr[2] = "http://soar.smugmug.com/photos/96144401-M.jpg";
function choosePhoto(parray)
{
inx = Math.floor(Math.random()*parray.length);
img = parray[inx];
document.write('<img border="2" src="' + img + '"/>');
}
Mike Lane
Sep-19-2006, 03:16 PM
http://soar.smugmug.com
does it belong somewhere else??? what makes the pics change????That'd be javascript. Make sure you're following along carefully when you read instructions for those sorts of things.
http://soar,smugmug.com
ok thanks
i think i am going to have to start all over on this banner thing.
what i originally wanted was 3 shots that randomly changed. i am really
new at this and it can become overwhelming.
in trying to change the banner i have messed up lining up the galleries 4 across and cannot find how to change it back.
i really need alot of help.
i would appreciate it if you would take a look
That'd be javascript. Make sure you're following along carefully when you read instructions for those sorts of things.
ok fixed the galleries.
now just need to work on those pics in the header.
would a fillmstip be easier????
http://soar,smugmug.com
ok thanks
i think i am going to have to start all over on this banner thing.
what i originally wanted was 3 shots that randomly changed. i am really
new at this and it can become overwhelming.
in trying to change the banner i have messed up lining up the galleries 4 across and cannot find how to change it back.
i really need alot of help.
i would appreciate it if you would take a look
oops--i put a comma in my addy
http://soar.smugmug.com
ok fixed the galleries.
now just need to work on those pics in the header.
would a fillmstip be easier????
m. dob
Nov-27-2006, 06:31 PM
I was curious if I could put 4 photos in the header like I have created in my banner here www.echoimagery.smugmug.com (http://www.echoimagery.smugmug.com) Would I need to create this in a table some how?
I am pretty sure I follow all that has been said about this so far and appreciate anyones insight/insite.
Thanks!
JS4KIKZ
Feb-06-2007, 04:15 PM
Hey, I've been lurking around for a while and finally needed an answer. I dont like posting unless the answer just isnt there or I cant find it. Well, I have managed to get my banner up and get it to change, but I cant figure out how to center it. Any help would be greatly appreciated.
my site: http://js4kikz.smugmug.com/
TIA
Lenny
Allen
Feb-06-2007, 04:25 PM
Hey, I've been lurking around for a while and finally needed an answer. I dont like posting unless the answer just isnt there or I cant find it. Well, I have managed to get my banner up and get it to change, but I cant figure out how to center it. Any help would be greatly appreciated.
my site: http://js4kikz.smugmug.com/
TIA
Lenny
Hope this helps, define the banner div in the header code and format it in CSS.
Change your header code to this
<div id="my_banner">
<img src="http://www.js4kikz.com/smugmug/banner4.jpg">
</div>
Add this to your CSS
#my_banner {
border:2px solid white;
margin:0 auto;
margin-top:10px;
height:150px;
width:800px;}
JS4KIKZ
Feb-06-2007, 04:27 PM
thank you very much! you are the man :wink
JS4KIKZ
Feb-06-2007, 04:33 PM
hmmmmmm, now the banner will not rotate through the 5 different banner pics i have.....
the banner links are: http://www.js4kikz.com/smugmug/banner1.jpg ....../banner5.jpg
JS4KIKZ
Feb-09-2007, 03:27 PM
bump
Andy
Feb-09-2007, 03:34 PM
Can someone rewrite this hack to use feeds instead?
richtersl
Jun-05-2007, 06:54 AM
I found this thread and have been fooling around with the code a bit. I've not implemented it on my site yet, but it works fine on just a plain old html page -- the photos change, etc.
It wasn't too difficult to figure out how to link to a single gallery but I'm not well versed enough in Javascript to figure out how to link each photo to the gallery from which it originated. I thought that a two-dimensional array might be the ticket but don't know how to incorporate that into the function.
var Ll = new Array();
Ll[0][0] = image1 URL
Ll[0][1] = image1 gallery URL
Ll[1][0] = image2 URL
Ll[1][1] = image2 gallery URL
Ll[2][0] = image3 URL
Ll[2][1] = image3 gallery URL
Ll[3][0] = image4 URL
Ll[3][1] = image4 gallery URL
How do I reference that here? About all I do know is that I have to construct an "a href" tag with the appropriate reference from the array. :scratch
function choosePhoto(parray)
{
inx = Math.floor(Math.random()*parray.length);
img = parray[inx];
document.write('<img border="2" src="' + img + '"/>');
}
This part's easy. (Whew!)
******** type="text/javascript">choosePhoto(Ll);</********
Is there a javascript knowledgeable person out there who can perhaps lend a hand?
Thanks!
guttman
Jul-08-2007, 01:34 PM
Hey all!
Actually, what I want is to do a similar thing in the body section with larger pictures: 3 vertical rotating pictures from 3 different galleries (rotating only when reloading page) and with an option to link to a specific gallery.
Somebody? Help??
Chen
PS - my site is @ guttman.smumug.com
Mike Lane
Jul-09-2007, 03:06 AM
Hey all!
Actually, what I want is to do a similar thing in the body section with larger pictures: 3 vertical rotating pictures from 3 different galleries (rotating only when reloading page) and with an option to link to a specific gallery.
Somebody? Help??
Chen
PS - my site is @ guttman.smumug.comUse this URL to generate a random image:
http://www.smugmug.com/photos/random.mg?AlbumID=XXX&Size=SMUGSIZE
You can use it in a linked image tag like so:
<a href="#">
<img src="http://www.smugmug.com/photos/random.mg?AlbumID=XXX&Size=SMUGSIZE" />
</a>
If you need more specific help, just let us know what it is exactly you want to do.
guttman
Jul-09-2007, 08:00 AM
Use this URL to generate a random image:
http://www.smugmug.com/photos/random.mg?AlbumID=XXX&Size=SMUGSIZE
You can use it in a linked image tag like so:
<a href="#">
<img src="http://www.smugmug.com/photos/random.mg?AlbumID=XXX&Size=SMUGSIZE" />
</a>
If you need more specific help, just let us know what it is exactly you want to do.
Hey Mike and thanks for the reply!
I don't know where to paste the code :scratch - obviously, not in the CSS part (nor in the JS part) - so, where? I want the three picture to show at the body part of the site (instead of smugmug's thumbnails of the different categories). I want to define the size and the location of each picture so that they will be placed at the center of the page, one next to each other.
Hope this will help see what I want (I am also attaching a sketch so you could get what I want - in the picture there are three pictures, representing each of my main categories - stage, travel and family).
http://guttman.smugmug.com/photos/171162938-L.jpg
Mike Lane
Jul-09-2007, 08:14 AM
Hey Mike and thanks for the reply!
I don't know where to paste the code :scratch - obviously, not in the CSS part (nor in the JS part) - so, where? I want the three picture to show at the body part of the site (instead of smugmug's thumbnails of the different categories). I want to define the size and the location of each picture so that they will be placed at the center of the page, one next to each other.
Hope this will help see what I want (I am also attaching a sketch so you could get what I want - in the picture there are three pictures, representing each of my main categories - stage, travel and family).
http://guttman.smugmug.com/photos/171162938-Th.jpgThat'll go in your bio box. Something like this (don't forget to change the parts in red):
<html>
<a href="#"><img src="http://www.smugmug.com/photos/random.mg?AlbumID=XXX&Size=SMUGSIZE" /></a>
<a href="#"><img src="http://www.smugmug.com/photos/random.mg?AlbumID=XXX&Size=SMUGSIZE" /></a>
<a href="#"><img src="http://www.smugmug.com/photos/random.mg?AlbumID=XXX&Size=SMUGSIZE" /></a>
</html>
We'll probably have to finagle it a little bit with CSS so once you get that in there just let us know. :thumb
guttman
Jul-09-2007, 08:59 AM
That'll go in your bio box. Something like this (don't forget to change the parts in red):
<html>
<a href="#"><img src="http://www.smugmug.com/photos/random.mg?AlbumID=XXX&Size=SMUGSIZE" /></a>
<a href="#"><img src="http://www.smugmug.com/photos/random.mg?AlbumID=XXX&Size=SMUGSIZE" /></a>
<a href="#"><img src="http://www.smugmug.com/photos/random.mg?AlbumID=XXX&Size=SMUGSIZE" /></a>
</html>
We'll probably have to finagle it a little bit with CSS so once you get that in there just let us know. :thumb
Hey Mike!
Thanks for the fast reply - the album ID is the gallery number? and the smugsize is the amount of pixels on the long orientation?:dunno
Chen
Mike Lane
Jul-09-2007, 09:27 AM
Hey Mike!
Thanks for the fast reply - the album ID is the gallery number? and the smugsize is the amount of pixels on the long orientation?:dunno
Chenyes for the gallery #. And yes for the size but you can have any of the smugmug sizes, Ti, Th, S, M, L, widthxheight
guttman
Jul-09-2007, 09:40 AM
yes for the gallery #. And yes for the size but you can have any of the smugmug sizes, Ti, Th, S, M, L, widthxheight
Hey Mike!
Sorry to bother more, but heck - it didn't work!
:scratch
Here is the HTML:
<html>
<a href="http://guttman.smugmug.com/Stage%20Photography"><img src="http://www.smugmug.com/photos/random.mg?AlbumID=3124672&Size=333x500" /></a>
<a href="http://guttman.smugmug.com/Travel%20Photography"><img src="http://www.smugmug.com/photos/random.mg?AlbumID=XXX&Size=500px" /></a>
<a href="http://guttman.smugmug.com/Family%20&%20Friends"><img src="http://www.smugmug.com/photos/random.mg?AlbumID=XXX&Size=500px" /></a>
</html>
I created only one gallery to see that it works well - I hope the fact the rest of the code is undefined didn't mess it up (I also used the original www.smugmug.com/photos... (http://www.smugmug.com/photos...) and it didn't work wither...
Can you please add a full example that I will see how exactly I write the attributes?
I really appreciate your time and effort!
Mike Lane
Jul-09-2007, 10:08 AM
Hey Mike!
Sorry to bother more, but heck - it didn't work!
:scratch
Here is the HTML:
<html>
<a href="http://guttman.smugmug.com/Stage%20Photography"><img src="http://www.smugmug.com/photos/random.mg?AlbumID=3124672&Size=333x500" /></a>
<a href="http://guttman.smugmug.com/Travel%20Photography"><img src="http://www.smugmug.com/photos/random.mg?AlbumID=XXX&Size=500px" /></a>
<a href="http://guttman.smugmug.com/Family%20&%20Friends"><img src="http://www.smugmug.com/photos/random.mg?AlbumID=XXX&Size=500px" /></a>
</html>
I created only one gallery to see that it works well - I hope the fact the rest of the code is undefined didn't mess it up (I also used the original www.smugmug.com/photos... (http://www.smugmug.com/photos...) and it didn't work wither...
Can you please add a full example that I will see how exactly I write the attributes?
I really appreciate your time and effort!I fixed some things up for you. add the gallery numbers to the second 2 images and you're on your way.
guttman
Jul-09-2007, 10:09 PM
I fixed some things up for you. add the gallery numbers to the second 2 images and you're on your way.
:barb
SOO COOL!!! Thanks very much!!!:thumb
What did I make wrong in the code??
I can specify the borders of the pictures through CSS, I persume - what is the code for doing that?
Oh, and another thing...In my Customer HTML page I want to put a logo of the company/studio on the right side and a description on the left - how can I specify a specific location for the picture location and also for the text? (In my "About Me" I didn't know how to specify a specific location for every element so I left it as is...)
Mike Lane
Jul-10-2007, 01:36 PM
:barb
SOO COOL!!! Thanks very much!!!:thumb
What did I make wrong in the code??
I can specify the borders of the pictures through CSS, I persume - what is the code for doing that?
Oh, and another thing...In my Customer HTML page I want to put a logo of the company/studio on the right side and a description on the left - how can I specify a specific location for the picture location and also for the text? (In my "About Me" I didn't know how to specify a specific location for every element so I left it as is...)First off you had your bio box hidden to your control panel. That was easy enough to fix by clicking show. But then it didn't show so I looked in your CSS and found this:
.bioBox {display:block;}
.loggedIn .bioBox {display:none;}
Which would explain why I couldn't see it. So since I couldn't for the life of me figure out why you would have that code :dunno I deleted it.
I think that was everything I did.
About your customer html page...
There are lots of ways to make this happen. It'd be easiest if I knew what content was actually going to go in there before I futzed with it though.
guttman
Jul-11-2007, 09:05 AM
First off you had your bio box hidden to your control panel. That was easy enough to fix by clicking show. But then it didn't show so I looked in your CSS and found this:
.bioBox {display:block;}
.loggedIn .bioBox {display:none;}
Which would explain why I couldn't see it. So since I couldn't for the life of me figure out why you would have that code :dunno I deleted it.
I think that was everything I did.
About your customer html page...
There are lots of ways to make this happen. It'd be easiest if I knew what content was actually going to go in there before I futzed with it though.
Hey Mike and thanks for the tip!
Tell you the truth, I played with lots of stuff that I read on the way so it must have been a relic of some sort of experimenting...
About the customers HTML - The content is a brief description on the left side and on the right side, the logo of the company/customer. I will prepare a sample (text and logo) and you can take it from there - once you gonna do one code, I will know how to replicate...
Also, how can I change the border thickness and color of the Bio box pictures?
and by the way, for some reason the photos in the sub-categories don't appear when Im logged off...any knowledge why?
GJMPhoto
Sep-20-2007, 05:05 AM
I'd like to do this as well...read through the entire thread and am now wondering...do I use the code posted by Rutt on May-09-2005, 11:24 AM or do I use the code Mike posted? What is the official solution now?
Thanks,
- Gary.
Mike Lane
Sep-20-2007, 07:18 AM
I'd like to do this as well...read through the entire thread and am now wondering...do I use the code posted by Rutt on May-09-2005, 11:24 AM or do I use the code Mike posted? What is the official solution now?
Thanks,
- Gary.You can use what I posted :thumb
fencingcellist
Mar-14-2008, 12:08 AM
Thanks to everyone for such great information! It's helped me start to put together my own random banner.
I've got a couple of questions to try to finish it off, here's the most pressing:
How can I add a SmugMug logo to the end of the banner with a link to my referral code? I've seen all sorts of references to removing the SmugMug logo from the top, but not how to add it so that it looks a bit like the banner on this forum site.
Thanks so much! As I never got a response to another question I had a few months ago, I hope I'm posting this correctly.
TIA, Brenda
www.bnphotogallery.com (http://www.bnphotogallery.com)
fencingcellist
Mar-23-2008, 07:12 PM
Hey Folks,
Again, many, many thanks for such great information on these forums. :clap
I have used so much of this information in working towards customizing my pages. However, I still need help. Is this the right place to ask for it? (I'm a newb, obviously.) Anyway, I've posted 4 times before (erased one after getting no response and spending many, many more hours on the forum here and finally fixing my problem more or less) so this is my 5th attempt at getting help and I'm batting about 25% success here so far. . . :cry
OK -- the questions is:
Same question as in the last post -- how do I put a "powered by SmugMug" image at the end of the banner with a link to my referral code?
OK. Please, please, please help. I'm a newbie but I really, really love SmugMug, and really want to customize my page. If I'm in the wrong place, or posting in the wrong forum or in the wrong format, please tell me -- I'll ask in the right place next time. I learn fast.
And really, I'm a BIG fan :lust-- I've now purchased 2 pro memberships, one power, and one regular including my own -- I give them as gifts!
Please . . .
TIA, Brenda
http://fencingcellist.smugmug.com
redkulas
Apr-22-2008, 06:44 PM
I fixed some things up for you. add the gallery numbers to the second 2 images and you're on your way.
Is there a way to show the actual picture that was clicked when using the random.mg?
Thanks,
Redkulas
aciurczak
Apr-22-2008, 07:45 PM
I think it's time I revisit my solution as well. I have a horrendously complicated javascript in my header code. It has an array of 500+ pictures; the code shows a certain number of small images, which are clickable to bring up a larger version of the clicked image in a centered popup window. The pictures also rotate out 1 by 1 every 15 seconds. It works great, but uploading new pictures is terribly cumbersome and simply pointing to a gallery would be a dream. But here's my question, I need something like this:
<a href="http://www.smugmug.com/photos/random.mg?AlbumID=XXX&Size=SMUGSIZE(large)"">
<img src="http://www.smugmug.com/photos/random.mg?AlbumID=XXX&Size=SMUGSIZE(small)" />
</a>
But obviously, this will pull two different random images so it won't work as intended. How can I use the random.mg code, but get hyperlinks to 2 different sizes of the same picture?
Here's a link (http://www.smugmug.com/community/MSMC) to the current page. If folks want to view the current code, they are welcome to it; here is a link to the javascript:
http://www.montgomerybikers.com/forums/clientscript/picrotate2.js
terterphotography
May-05-2008, 01:07 PM
That'll go in your bio box. Something like this (don't forget to change the parts in red):
<html>
<a href="#"><img src="http://www.smugmug.com/photos/random.mg?AlbumID=XXX&Size=SMUGSIZE" /></a>
<a href="#"><img src="http://www.smugmug.com/photos/random.mg?AlbumID=XXX&Size=SMUGSIZE" /></a>
<a href="#"><img src="http://www.smugmug.com/photos/random.mg?AlbumID=XXX&Size=SMUGSIZE" /></a>
</html>
We'll probably have to finagle it a little bit with CSS so once you get that in there just let us know. :thumb
I am new here and I am trying to get my page set up. i feel like a dummy but all the codes are confusing to me. I want mine to look similar to your header. Can you help?
I am at www.terrasphotos.smugmug.com (http://www.terrasphotos.smugmug.com)
terterphotography
May-05-2008, 01:27 PM
I am new to this and need some help. I feel like a dummy but all this code stuff is very confusing to me! I am looking for my header to look something similar to yours with my photos of course.
I am at www.terrasphotos.smugmug.com (http://www.terrasphotos.smugmug.com)
If you could give me some help with codes and all I would really appreaciate it!
Hey Mike and thanks for the reply!
I don't know where to paste the code :scratch - obviously, not in the CSS part (nor in the JS part) - so, where? I want the three picture to show at the body part of the site (instead of smugmug's thumbnails of the different categories). I want to define the size and the location of each picture so that they will be placed at the center of the page, one next to each other.
Hope this will help see what I want (I am also attaching a sketch so you could get what I want - in the picture there are three pictures, representing each of my main categories - stage, travel and family).
http://guttman.smugmug.com/photos/171162938-L.jpg
aciurczak
Jun-12-2008, 11:27 AM
I'm having weird issues with the random banner code. If I put in the album ID of my older albums, it works fine. But for my newer albums, it doesn't work anymore.
For example, this code works fine:
http://www.smugmug.com/photos/random.mg?AlbumID=2873989_f85R7&Size=800x800
But this same code, for a newer album, shows nothing.
http://www.smugmug.com/photos/random.mg?AlbumID=5058623_P6ULM&Size=800x800
I've cut and pasted a dozen times to make sure I wasn't just mistyping things, but I'm pretty sure that something is hosed. It appears that the albums with the new sizes (not the old S,M,L,O) don't work. Any ideas?
denisegoldberg
Jun-13-2008, 05:55 AM
I'm having weird issues with the random banner code. If I put in the album ID of my older albums, it works fine. But for my newer albums, it doesn't work anymore.
For example, this code works fine:
http://www.smugmug.com/photos/random.mg?AlbumID=2873989_f85R7&Size=800x800
But this same code, for a newer album, shows nothing.
http://www.smugmug.com/photos/random.mg?AlbumID=5058623_P6ULM&Size=800x800
You need to add the album key for the newer albums. I use the random code all of the time, and it works fine as long as the key is specified in addition to the album id. When you look at the url for your gallery, you will see something like 5150485_u2pN4. The first part of that is the album id, and the second is the album key.
Here's an example from one of my galleries:http://www.denisegoldberg.com/photos/random.mg?AlbumID=5150485&AlbumKey=u2pN4&Size=450x450 (http://www.denisegoldberg.com/photos/random.mg?AlbumID=5150485&AlbumKey=u2pN4&Size=450x450)
--- Denise
aciurczak
Jun-13-2008, 06:08 AM
That did it, thx! I was putting the album key as "albumID_albumkey" since that is what the url looks like when you click on a picture in the gallery, didn't try explicitly stating "albumkey=", but it worked, just like you said! Thx again.
aciurczak
Jun-13-2008, 07:13 AM
Well, it's working, but the behavior is markedly different in IE vs. Firefox. IE sees it at as a new picture upon every page reload, but FF requires the user to hit refresh before a new page is loaded.
Check out http://ninjette.org. The splash page works fine in either browser. But once it gets to the forum page, the behavior is different between the two browsers for the pic in the upper left. Click on any link on the page and IE pops up a new pic, FF keeps it the same until "refresh".
Maki
Jun-23-2008, 08:50 PM
This does not work with protected galleries, no? I've been using the old Rutt method (hey, I've been away from these forums for almost 3 years?) by specifying the file names, which works for protected galleries as well.
Use this URL to generate a random image:
http://www.smugmug.com/photos/random.mg?AlbumID=XXX&Size=SMUGSIZE
You can use it in a linked image tag like so:
<a href="#">
<img src="http://www.smugmug.com/photos/random.mg?AlbumID=XXX&Size=SMUGSIZE" />
</a>
If you need more specific help, just let us know what it is exactly you want to do.
aciurczak
Feb-10-2009, 01:05 AM
Is there any way to use the smugmug random code to populate more than one photo of the same size on the same page without getting repeats?
If I put the same code:
http://www.smugmug.com/photos/random.mg?AlbumID=934571&AlbumKey=ru5yx&Size=Th
http://www.smugmug.com/photos/random.mg?AlbumID=934571&AlbumKey=ru5yx&Size=Th
http://www.smugmug.com/photos/random.mg?AlbumID=934571&AlbumKey=ru5yx&Size=Th
twice on the same page, the exact same photo shows up (as seen above, hit refresh to test). Thanks for any suggestions. It looks like the way dgrin gets around it in this header is simply using multiple galleries and choosing a random pic from each one. I'd like to be able to do it all from a single gallery if possible.
jfriend
Feb-10-2009, 07:34 AM
Is there any way to use the smugmug random code to populate more than one photo of the same size on the same page without getting repeats?
If I put the same code:
http://www.smugmug.com/photos/random.mg?AlbumID=934571&AlbumKey=ru5yx&Size=Th
http://www.smugmug.com/photos/random.mg?AlbumID=934571&AlbumKey=ru5yx&Size=Th
http://www.smugmug.com/photos/random.mg?AlbumID=934571&AlbumKey=ru5yx&Size=Th
twice on the same page, the exact same photo shows up (as seen above, hit refresh to test). Thanks for any suggestions. It looks like the way dgrin gets around it in this header is simply using multiple galleries and choosing a random pic from each one. I'd like to be able to do it all from a single gallery if possible.
When the gallery pages are fetching a random thumbnail, they append a random number onto the end of the URL. I don't know if that is to defeat caching and/or if that helps solve your question, but you can try using a different number on the end of the URL each time you use it. In the gallery page, it looks like this (with &rand=xxxx on the end):
http://jfriend.smugmug.com/photos/random.mg?AlbumID=6699222&Size=Tiny&AlbumKey=eTvjt&rand=8075
aciurczak
Feb-10-2009, 08:19 AM
It looks like that works! I tried copying their code exactly with the RAND parameter, but I must not have gotten the syntax exactly right in my header. When I added rand=1000 to one of them and rand=2000 to the other, they do pick different pictures. Which is great! Now the only hitch (a very small one) would be to see if there is a way to make sure the same picture doesn't appear. I see that they use a command called "no-repeat" in their code, but it appears to be part of the DIV CLASS rather than a component of the random.mg? call.
http://www.smugmug.com/photos/random.mg?AlbumID=934571&AlbumKey=ru5yx&Size=Th&RAND=1000
http://www.smugmug.com/photos/random.mg?AlbumID=934571&AlbumKey=ru5yx&Size=Th&RAND=2000
http://www.smugmug.com/photos/random.mg?AlbumID=934571&AlbumKey=ru5yx&Size=Th&RAND=1000
http://www.smugmug.com/photos/random.mg?AlbumID=934571&AlbumKey=ru5yx&Size=Th&RAND=2000
EDIT: looks like the "no-repeat" has nothing to do with the picture chosen, and more to do with how many times that particular picture is duplicated on the screen for backgrounds. My gallery has 600+ pics in it, so the likelihood of repeats being seen as a problem is low, though it may happen from time to time.
aciurczak
Feb-10-2009, 09:33 PM
Pretty happy with how it's working now, it can be seen right here (http://www.montgomerybikers.com/index2.php).
But, I've got yet another question that I wonder if anyone has any suggestions for. How would you suggest getting the same random picture, but in multiple sizes?
http://www.smugmug.com/photos/random.mg?AlbumID=934571&AlbumKey=ru5yx&Size=Th&RAND=1000
http://www.smugmug.com/photos/random.mg?AlbumID=934571&AlbumKey=ru5yx&Size=S&RAND=2000
The two pics above have the same RAND number, but they are still different pics. I was wondering if there was some way to set a variable equal to the first random.mg call, but looking at the properties of the end picture, it stays as random.mg; it's not like smugmug is returning the actual URL of the original picture. The reason I want to do this is that I want the HREF of these images to be a large version of the thumbnail pic. But if I put the random code in there twice, they aren't of the same pic, unless they are the same size (which defeats the purpose)
Thanks as always for any thoughts or suggestions.
Janneman
Feb-10-2009, 11:03 PM
A similar question which did get no reply in another post so I try it here again.
I have been working on my site a bit and was trying to improve the header with a few random thumbnails. I would like to get those from my popular and favorite (keyword) galleries. But that does not seem to work. It seems to work only with static galleries. For the time being I improvised something with static galleries. But I would like to base the random header thumbs on my popular and favorite (keyword) galleries.
I would hate to copy all popular and favorite files to a separate gallery and having to update that each time I add a new image or someone comments on a new shot.
At this moment I am using the following call:
http://kooreman.smugmug.com/photos/random.mg?AlbumID.......
Is there anybody who knows a solution for this?
Thanks for the help.
Janneman
Feb-11-2009, 11:46 PM
I posted this question 2 times without any reply. Is there anybody out there who can tell me if this is possible or not? Thanks.
A similar question which did get no reply in another post so I try it here again.
I have been working on my site a bit and was trying to improve the header with a few random thumbnails. I would like to get those from my popular and favorite (keyword) galleries. But that does not seem to work. It seems to work only with static galleries. For the time being I improvised something with static galleries. But I would like to base the random header thumbs on my popular and favorite (keyword) galleries.
I would hate to copy all popular and favorite files to a separate gallery and having to update that each time I add a new image or someone comments on a new shot.
At this moment I am using the following call:
http://kooreman.smugmug.com/photos/random.mg?AlbumID.......
Is there anybody who knows a solution for this?
Thanks for the help.
jfriend
Feb-12-2009, 12:15 AM
A similar question which did get no reply in another post so I try it here again.
I have been working on my site a bit and was trying to improve the header with a few random thumbnails. I would like to get those from my popular and favorite (keyword) galleries. But that does not seem to work. It seems to work only with static galleries. For the time being I improvised something with static galleries. But I would like to base the random header thumbs on my popular and favorite (keyword) galleries.
I would hate to copy all popular and favorite files to a separate gallery and having to update that each time I add a new image or someone comments on a new shot.
At this moment I am using the following call:
http://kooreman.smugmug.com/photos/random.mg?AlbumID.......
Is there anybody who knows a solution for this?
Thanks for the help. The only way I know of to do this would be to use a feed for your popular or keyword galleries, fetch the feed from javascript, use javascript to parse the XML results from the feed and then you'd have the image links that you could then display however you want. This is non-trivial javascript to write, but it sounds like it might be doable.
Janneman
Feb-12-2009, 12:43 AM
The only way I know of to do this would be to use a feed for your popular or keyword galleries, fetch the feed from javascript, use javascript to parse the XML results from the feed and then you'd have the image links that you could then display however you want. This is non-trivial javascript to write, but it sounds like it might be doable.
Programming JS is beyond me. So I gues I have to forget that for the time being till someone programmes this. :cry
markhumpage
Mar-04-2009, 12:31 PM
I am really struggling here and could do with some walk through help please. I'd like to get the rotating banner images inside a header and have tried pasting relevant code from very first threads but nothing seems to work. I appreciate this is quite old but have code things changed?
Appreciate some help.
Thanks
Mark
EDIT sorry forgot my site - http://www.markhumpage.com
Janneman
Mar-05-2009, 11:29 AM
I am really struggling here and could do with some walk through help please. I'd like to get the rotating banner images inside a header and have tried pasting relevant code from very first threads but nothing seems to work. I appreciate this is quite old but have code things changed?
Appreciate some help.
Thanks
Mark
EDIT sorry forgot my site - http://www.markhumpage.com
Mine works fine. I used the html solution from page 2 in my header. Although I should mention that it only works for galleries with actual photo's in them. So you cannot do this with galleries based on keywords and the like.
I vaguely remember getting my solution form another thread with parts from our html expert Allen (http://www.dgrin.com/member.php?u=751).
Hope this helps
SamirD
Jul-22-2009, 07:42 AM
Pretty happy with how it's working now, it can be seen right here (http://www.montgomerybikers.com/index2.php).
But, I've got yet another question that I wonder if anyone has any suggestions for. How would you suggest getting the same random picture, but in multiple sizes?
http://www.smugmug.com/photos/random.mg?AlbumID=934571&AlbumKey=ru5yx&Size=Th&RAND=1000
http://www.smugmug.com/photos/random.mg?AlbumID=934571&AlbumKey=ru5yx&Size=S&RAND=2000
The two pics above have the same RAND number, but they are still different pics. I was wondering if there was some way to set a variable equal to the first random.mg call, but looking at the properties of the end picture, it stays as random.mg; it's not like smugmug is returning the actual URL of the original picture. The reason I want to do this is that I want the HREF of these images to be a large version of the thumbnail pic. But if I put the random code in there twice, they aren't of the same pic, unless they are the same size (which defeats the purpose)
Thanks as always for any thoughts or suggestions.I second this. I'm trying to do the same thing.
SamirD
Jul-22-2009, 03:27 PM
I've figured out a way to do this, but it requires external coding. I was planning on doing this anyways, so it's not a big deal in my application.
My question is does this random image generator also return videos?
SamirD
Jul-22-2009, 05:05 PM
I just tested this on one of my galleries that was mostly full of videos. It returns the screenshot of the video without the play button on it.
ATPphotos
Jul-27-2009, 03:36 PM
If you need more specific help, just let us know what it is exactly you want to do.
i'm a bit baffled by all of the different codes in this thread. what i am trying to do is simply have a random banner (which i have pre-made) appear in my header upon each refresh or nav to another page, like this:
http://www.krisdobie.smugmug.com (http://www.krisdobie.smugmug.com/)
i cannot decipher his source code. what code do i use and in what field do i put it? should i create an unlisted gallery to hold all of the banners or will i just be using the url to each image? help would be greatly appreciated!
my page: http://www.atpphotos.smugmug.com
(homepage under construction so pardon the mess)
denisegoldberg
Jul-27-2009, 04:10 PM
i'm a bit baffled by all of the different codes in this thread. what i am trying to do is simply have a random banner (which i have pre-made) appear in my header upon each refresh or nav to another page.
Put all of the images that you want to use for your banner in a new gallery. Set it to unlisted so it won't show on your galleries screen (unless you are logged in, in which case you will see it).
Then, use the code from this post http://www.dgrin.com/showpost.php?p=629221&postcount=2 as the url for your banner image. Place your album id and album key in the url.
--- Denise
ATPphotos
Jul-27-2009, 04:14 PM
Put all of the images that you want to use for your banner in a new gallery. Set it to unlisted so it won't show on your galleries screen (unless you are logged in, in which case you will see it).
Then, use the code from this post http://www.dgrin.com/showpost.php?p=629221&postcount=2 as the url for your banner image. Place your album id and album key in the url.
--- Denise
simple enough. thank you!
ATPphotos
Jul-27-2009, 10:15 PM
Put all of the images that you want to use for your banner in a new gallery. Set it to unlisted so it won't show on your galleries screen (unless you are logged in, in which case you will see it).
Then, use the code from this post http://www.dgrin.com/showpost.php?p=629221&postcount=2 as the url for your banner image. Place your album id and album key in the url.
--- Denise
Denise, i got the banner thing worked out then created a custom navbar. everything looked fine but once i tried to tweak the padding on either the top of the banner or the navbar something strange happened. the nav font size appears to be ok on the homepage and the galleries page (portfolio) but on certain pages/galleries (bio, journal, prints, contacts) the font size is smaller. i've spent hours trying to correct the problem using trial and error, to no avail. could you take a peek and see what i might have screwed up? i'm guessing the problem is in this section of css, but i'm not sure. didn't make changes anywhere else...
CSS:
/* randomizes banners in header */
#my_banner {
width: 752px;
height: 248px;
margin: 0 auto;
margin-top: 15px;
background: url(http://www.smugmug.com/photos/random.mg?AlbumID=9065529&AlbumKey=RwUmo&Size=O) no-repeat;
}
/* navigation under banner */
#navcontainer ul {
margin: 0;
padding: 0;
list-style-type: none;
text-align: center;
}
#navcontainer ul li {
display: inline;
}
#navcontainer ul li a {
text-decoration: none;
padding: .9em 3em;
color: #ccc;
background-color: none;
}
#navcontainer ul li a:hover {
text-decoration: none;
color: #fff;
background-color: none;
}
CUSTOM HEADER:
<div id="my_banner"> </div>
<div id="navcontainer">
<ul>
<li><a href="http://www.atpphotos.com">home</a></li>
<li><a href="http://www.atpphotos.com/galleries">portfolio</a></li>
<li><a href="http://www.atpphotos.com/gallery/8953853_67uND">bio</a></li>
<li><a href="http://www.atpphotos.com/gallery/9017483_SZ4TZ">journal</a></li>
<li><a href="http://www.atpphotos.com/gallery/8956256_dkNvA">prints</a></li>
<li><a href="http://www.atpphotos.com/gallery/8994169_vBrUr">contact</a></li>
</ul>
</div>
any ideas?? :dunnothanks in advance!
http://www.atpphotos.smugmug.com
SamirD
Jul-28-2009, 10:56 AM
I don't know how to do this, but I think if you specify a font size, it should stick with it on all pages.
ATPphotos
Jul-28-2009, 11:03 AM
I don't know how to do this, but I think if you specify a font size, it should stick with it on all pages.
i had specified a size in the easy customizer and thought that might have been what was throwing it off so i did away with that then tried doing it in the code. no good. no matter what i do, the font size is ok on my homepage and galleries page but nowhere else. it's gotta be something simple and stupid that i'm overlooking :scratch
i tried taking out the html and leaving the div in the custom header. this leaves my nav in a list on the side of the page. i was able to click it to navigate. even with the html code out, text still appears small in those galleries so i know it's not a problem with the nav code. i also removed all code that had anything to do with hiding things in those problem galleries. same issue. this is beginning to drive me nuts! i hope someone will have the answer.
update: i tried EVERYTHING. closing the ticket and just assuming that text will appear differently on the navbar in galleries than it does on the homepage when using custom navbar code. back to the easy customizer i go...
SamirD
Jul-28-2009, 01:06 PM
Sounds like there's two different elements that specify the text size. I'd have no clue what they are, but if you can get both of those set the same, it should do what you want. Easy customizer might be a place to start and then see what it's adding and the options. Feel free to guess. I figured out how to turn off saving movies in every gallery this way.
ATPphotos
Jul-28-2009, 01:27 PM
Sounds like there's two different elements that specify the text size. I'd have no clue what they are, but if you can get both of those set the same, it should do what you want. Easy customizer might be a place to start and then see what it's adding and the options. Feel free to guess. I figured out how to turn off saving movies in every gallery this way.
i was only able to make it appear the way i wanted it to by setting a site-wide navbar font size using the easy customizer. i know no other way. maybe there's a text-size code i can put in that will override everything else? or maybe it's just a wacky thing with custom navbars on gallery pages. i don't know but i've given up. for now, i am using the easy customizer to create a navbar and hiding it so that my custom navbar works right - until someone can help me correct the problem of course.
jfriend
Jul-28-2009, 06:36 PM
i was only able to make it appear the way i wanted it to by setting a site-wide navbar font size using the easy customizer. i know no other way. maybe there's a text-size code i can put in that will override everything else? or maybe it's just a wacky thing with custom navbars on gallery pages. i don't know but i've given up. for now, i am using the easy customizer to create a navbar and hiding it so that my custom navbar works right - until someone can help me correct the problem of course. This issue being discussed over here (http://www.dgrin.com/showthread.php?p=1171155).
SamirD
Aug-28-2009, 03:24 PM
How would one call this random script inside of a php file with the objective of getting the returned url into a php variable?
Trying to do something like this:$output = http://newpics.huntsvillecarscene.com/photos/random.mg?AlbumID=1700966&Size=Th&AlbumKey=8AhGT&rand=8075
SamirD
Aug-28-2009, 10:34 PM
I need this to make a 'clicktoImage' type link from the image like in the slideshow.
Unless someone wants to change random.mg for me and make a 'clicktoImage' option. That would work best actually. I hate coding at 1am...
jfriend
Aug-28-2009, 10:44 PM
How would one call this random script inside of a php file with the objective of getting the returned url into a php variable?
Trying to do something like this:$output = http://newpics.huntsvillecarscene.com/photos/random.mg?AlbumID=1700966&Size=Th&AlbumKey=8AhGT&rand=8075 When you do a get on that URL, it returns a 302 result with the URL of the image it picked in the 302 response. You should just be able to parse that response and get the URL out of the response with the right PHP. I don't know PHP so can't help you there.
SamirD
Aug-28-2009, 10:50 PM
When you do a get on that URL, it returns a 302 result with the URL of the image it picked in the 302 response. You should just be able to parse that response and get the URL out of the response with the right PHP. I don't know PHP so can't help you there.The problem is that with every php function/method/whatever, it reads in the actual file, not the base URI, which is what I need.
I'm looking at this page right now and wondering how this gets the info I want:
http://www.davespeed.com/cgi-bin/fetch.cgi
I'm trying it with the link above and it gets the proper URL in the Base URI. I want that.
Either that or you can save me a lot of grief and have a 'clicktoImage' option added on random.mg. After seeing a lot of the uses of the random picture module, I think a lot of people are using it for linking anyways and would use the option.
jfriend
Aug-28-2009, 11:18 PM
The problem is that with every php function/method/whatever, it reads in the actual file, not the base URI, which is what I need.
I'm looking at this page right now and wondering how this gets the info I want:
http://www.davespeed.com/cgi-bin/fetch.cgi
I'm trying it with the link above and it gets the proper URL in the Base URI. I want that.
Either that or you can save me a lot of grief and have a 'clicktoImage' option added on random.mg. After seeing a lot of the uses of the random picture module, I think a lot of people are using it for linking anyways and would use the option. You need a way to get just the HTTP response and not actually process the 302 redirect. I'm sure there's a way to do that in PHP, but I don't know PHP myself so I can't help you.
I don't work for Smugmug so I can't do anything about the random.mg function.
SamirD
Aug-29-2009, 07:40 AM
After hours of mindnumbing searching last night, I found a function that uses the built-in curl library in php to get the header. From there I was able to parse the base URI. FINALLY! Now I'm halfway there. :clap
Now there's something I've run across that I'm wondering about. The galleries base names have always been 7 characters, but I noticed the random images base name can be either 8 or 9. Am I correct? Do you think there will there be possible changes to this in the future? If so, I can design my parsing to work differently and be future-proof.
I didn't realize you didn't work for SM. You're one of the most helpful coders out there, so you really should be on their payroll!
jfriend
Aug-29-2009, 08:29 AM
After hours of mindnumbing searching last night, I found a function that uses the built-in curl library in php to get the header. From there I was able to parse the base URI. FINALLY! Now I'm halfway there. :clap
Now there's something I've run across that I'm wondering about. The galleries base names have always been 7 characters, but I noticed the random images base name can be either 8 or 9. Am I correct? Do you think there will there be possible changes to this in the future? If so, I can design my parsing to work differently and be future-proof.
I didn't realize you didn't work for SM. You're one of the most helpful coders out there, so you really should be on their payroll! Gallery IDs are not a fixed number of characters. I find it work best to use a regular expression to pull the gallery ID and key out of an URL. The gallery key is a fixed number of characters.
SamirD
Aug-29-2009, 08:40 AM
Gallery IDs are not a fixed number of characters. I find it work best to use a regular expression to pull the gallery ID and key out of an URL. The gallery key is a fixed number of characters.I've found every gallery base number of characters to be 7. :scratch I've seen the base image characters vary between 8 and 9.
Also, what does xxx in rand=xxx need to be? A number? Characters?
SamirD
Aug-29-2009, 09:02 AM
Added a request for clicktoImage option for random.mg on the feedback/suggestions system. Vote here:
http://smugmug.uservoice.com/pages/17723-smugmug/suggestions/301701-clicktoimage-option-for-random-mg
SamirD
Sep-01-2009, 10:11 AM
I've found every gallery base number of characters to be 7. :scratch I've seen the base image characters vary between 8 and 9. Are these correct?
Also, what does xxx in rand=xxx need to be? A number? Characters?Does anyone have the answers to these two questions?
jfriend
Sep-01-2009, 11:26 AM
I've found every gallery base number of characters to be 7. :scratch I've seen the base image characters vary between 8 and 9.
Also, what does xxx in rand=xxx need to be? A number? Characters? Gallery numbers are getting larger and longer over time. You should not program to any fixed length. Use a regular expression to match any sequence of sequential digits.
rand=xxx is numbers. It's a random number seed to both fool intervening cache's or proxies (so you get something different every time) and probably to help increase randomness of which image is returned. If you aren't as concerned about perfect randomness, you can even leave it out I believe.
SamirD
Sep-01-2009, 12:46 PM
Gallery numbers are getting larger and longer over time. You should not program to any fixed length. Use a regular expression to match any sequence of sequential digits.That's kinda what I thought. I'll have to just fix this if it breaks. I've already coded it and don't have time to change it.
rand=xxx is numbers. It's a random number seed to both fool intervening cache's or proxies (so you get something different every time) and probably to help increase randomness of which image is returned.Do you think this will accept characters for the same purpose? Or just numbers? I've got it set to numbers right now, but characters would allow me to use it as an identifier for each image as well.
jfriend
Sep-01-2009, 01:12 PM
That's kinda what I thought. I'll have to just fix this if it breaks. I've already coded it and don't have time to change it.
Do you think this will accept characters for the same purpose? Or just numbers? I've got it set to numbers right now, but characters would allow me to use it as an identifier for each image as well. A unique char value would defeat intervening caching OK, but one would have to see the server code or devise a scientific test to tell if a char value was doing anything for the server.
SamirD
Sep-01-2009, 01:42 PM
A unique char value would defeat intervening caching OK, but one would have to see the server code or devise a scientific test to tell if a char value was doing anything for the server.Tried it with various character only seeds. Looks like it works.
SamirD
Nov-06-2009, 07:41 PM
Gallery numbers are getting larger and longer over time. You should not program to any fixed length. Use a regular expression to match any sequence of sequential digits.Finally broke. I'll adapt my code for the image number for the gallery number. Should be a quick fix. :thumb
If anyone is interested in seeing my random image click to gallery module in action, check out my web site and look on the right side below the weather module.
vBulletin v3.5.2, Copyright ©2000-2009, Jelsoft Enterprises Ltd.