PDA

View Full Version : Automatically generate pages??



Zaph
04-06-2005, 12:57 PM
OK, tricky one here, and i'm not even sure it's possible.
Basically, i need a script that automatically generates a page from the contents of a folder. I need the page to resize images in a folder and display them as thumbnails, along with some text describing the image, and then to also create a link to (another) automatically generated page which shows the first image but at full size. This last page also needs to have a unique title and other unique texts (like a heading).

any ideas? or am i going to have to do this all manually for ever?

Cheers,
Martyn.

jscheuer1
04-06-2005, 05:10 PM
You don't want to do that. Get a Gallery or other Image processing program to make your thumgnails in batch mode. With bilinear resampling, they will not only reduce d/l times tremendously but, also look much better. Now, as for generating pages of thumbnails, a Gallery program can be good for that. Many allow you to specify (the better ones even allow you to create) templates so that thumbnail and page creation are a one pass operation. I have also used this strategy:

<script type="text/javascript">
<!--
cap = ["Ira Josephs aka Carrot Man ", // Caption #1
"Fun & Frolic . . .", //Caption #2
"Mirth . . .", // Caption #3
"Kim Trusty", // Caption #4
"Music at", // Caption #5
"Bud Light Main Stage . . .", // Caption #6
"&nbsp;", // Caption #7
"&nbsp;", // Caption #8
"&nbsp;", // Caption #9
"State Street", // Caption #10
"Plum Mall Stage . . .", // Caption #11
"&nbsp;", // Caption #12
"&nbsp;", // Caption #13
"Oh Baby! ", // Caption #14
"&nbsp;", // Caption #15
"Volunteers put . . .", // Caption #16
"up signs ", // Caption #17
"Stage construction . . . ", // Caption #18
"&nbsp;", // Caption #19
"&nbsp;", // Caption #20
"&nbsp;", // Caption #21
"It Works!", // Caption #22
"Thanks Kurt!", // Caption #23
"Stage 'Right'!" ] //Caption #24
for (i = 1; i <= 24; i++)
{
if (i<=9){j="_0"+i}
else{j="_"+i}
if (i==1){j=""}
if (i%2==1){document.write("<tr><td>")}
else{document.write("<td align=\"right\">")}
document.write("<a href=\"detail/detail"+j+".html\" target=\"detail\"><img src=\"img_ind/"+i+"_side.jpg\" alt=\"Image: #"+i+"\"></a>")
document.write("<br><span style=\"position: relative; left:20;\">"+cap[(i-1)]+"</span></td></tr>")
}
//-->
</script>to generate a page with captions but, ONLY on a page that passively requires requires JavaScript enabled before the user gets to it, with an alternate gallery shown to the non-JavaScript folks. It would be pointless to use this as your sole thumbnail page because non-JavaScript enabled browsers see nothing.

mwinter
04-06-2005, 06:12 PM
OK, tricky one here, and i'm not even sure it's possible.It's not with client-side scripting. However, it's very possible server-side.

A response (http://www.dynamicdrive.com/forums/showpost.php?p=7286&postcount=2) I made to a thread on similar lines might be of use.


or am i going to have to do this all manually for ever?You should never allow user agents to resize images; they do a terrible job. Server-side image manipulation utilities (such as gd (http://www.boutell.com/gd/) which is used by PHP) and any self-respecting graphics software (The GIMP (http://www.gimp.org/) [GNU Image Manipulation Program] is free and feature-rich) will achieve much better results.

Mike

Zaph
04-06-2005, 08:23 PM
Thanks for the input guys.

I need this for the same intranet I've been working on for the last few months (it feels like years!) that I mentioned in another thread (about the Anylink dropdown menu).

The company I work for also has an online ordering system, and that uses a java applet to create the page... You fill in all the relevant fields with any required info, ftp the picture to the server and bingo, the page updates. Now we paid vast quantities of cash for this system (quite a few years ago, too) and now they want me to do something similar here (and they're paying me nothing extra :rolleyes: ). They want things done this way so that other ppl can update the site if I am unable to for any reason.

Now one problem I have with some of the things you have suggested is the fact I dont even know what php is let alone what it can do or how to do it!

However, one simplifying factor is the fact that the only people viewing the site will be employees, and they will all be using the same browser (IE6 - I know, I know!) with fully enabled java, etc. so I dont have to worry about accessability - i.e. if it works for me that is enough. Another bonus is the fact that as one of the network admins, I have full access to the server that the site will eventually be hosted on.

Any more suggestions or more "coding for dummies" help would be most appreciated!

Dare I say it once again that you guys on here are doing a sterling job?! :cool:

mwinter
04-08-2005, 12:11 PM
Sorry for the delay. :(


I need this for the same intranetIntranets sometimes let you adjust the playing field, but I don't think so in this case. With IE under a more lax security environment, you can access the local filesystem using the FileSystemObject object...


You fill in all the relevant fields with any required info, ftp the picture to the server and bingo, the page updates....but you're still talking in terms of servers, so that probably isn't of much use. Still, for future reference you can find information about it in Microsoft's JScript Language Reference (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/js56jslrfjscriptlanguagereference.asp).


Now one problem I have with some of the things you have suggested is the fact I dont even know what php is let alone what it can do or how to do it!PHP is a server-side language along the same lines as ASP, JSP, anything via CGI, etc. The language you use doesn't really matter, as long as it's supported by your servers and it has the necessary libraries to do what you want. Thinking about that, you're going to need a database really to store the various bits of text to go with each image, unless you want to design a file format to store it in binary or text files.

As far as gallery generation in PHP is concerned, the Gallery Project (http://gallery.menalto.com/modules.php?op=modload&name=News&file=index) is a good place to start. There are bound to be similar pre-built systems for other languages, too.

So, if a client-side alternative is truly out of the question, what server-side languages do you have at your disposal? Be aware that I only have knowledge of PHP, so I couldn't really help you with other languages.

Mike

Zaph
04-08-2005, 01:26 PM
A little background might help here.

I work as an IT support analyst for a large electrical distribution company, and the bosses upstairs have decided to impliment an intranet for all sorts of information to be easily accessible. Now the job was given to me, in the full knowledge that the most experience I've had is a couple of "hello, this is me" type websites.
Their intention is that once I have a basic version up and running they will provide me with training, etc. to improve it.

Now, I will have a brand new server to play with which will host it on our domain, and it will be server 2003 based. I'm not sure what languages, etc. I will have at my disposal as you put it, but pretty much anything that will run on that will be.

Like I said before, i'm a complete novice, but I like to think that I have a somewhat logical brain, and I am able to learn quite quickly (which is always useful)

The online catalogue I mentioned earlier was just an example of the sort of thing we need, but as you pointed out, that is not hosted here, but by our ISP, who also do all the maintainence on it. The applet that handles the page creation was a custom program written for us a good 5 or 6 years ago, and i'm not 100% sure how it works.

Luckily, the one big advantage I have with this project is the fact that all the PC's in my company have standard builds, and therefore I only need to make sure it works properly in IE6 (none of that messing around with Netscape or Firefox). The big problem is my need to learn to run before i can walk ;) .

Oh, and dont worry about your delay in replying... I appreciate all the help and advice you people give to numpties like me!

mwinter
04-10-2005, 12:18 AM
Now, I will have a brand new server to play with which will host it on our domain, and it will be server 2003 based.Then your primary language will probably be ASP, though PHP can run with IIS (Microsoft's Web server). However, I have zero knowledge of ASP, so I'm afraid you're on your own. At least from my perspective. Perhaps someone else can chip in.

Rereading this thread, it sounds like you're after a content management system (CMS), which is what this applet seems to be. There are many around. Some specialised. Some not. Some will be free. Some will be far from it. All of them will allow any particular group of users to modify content if necessary, using direct mark-up, WYSIWYG, or pseudo-tag interfaces. Which one you'd want to use would be down to your precise requirements, so again you'll be on your own.

I really wish I could help more, but I think I can do little more than nudge you in (hopefully) the right direction.

Good luck,
Mike

Zaph
04-10-2005, 10:13 AM
Thanks a lot Mike, I appreciate the effort!

I'll start trawling the web for a suitable CMS, and also to start boning up on asp.

If I find something that works then I'll post back here, just in case someone else has a similar problem ;)

Thanks again!
Martyn.