开发者

Image Viewer and Include File

开发者 https://www.devze.com 2023-03-05 21:29 出处:网络
I am working on a project that is an imageviewer for a website. I have a question on the best methodology for making what I want to work.

I am working on a project that is an imageviewer for a website. I have a question on the best methodology for making what I want to work.

What I am Doing

Basically, I am using an image viewer called "Prometeus" (Written by Gerard Ferrandez - http://www.dhteumeuleu.com - Feb 2005) and in the one block of code for the html page you must put the format:

<img src="../images/filename.jpg"><span>Tag for image</span>

The file must be .jpg, a certain size.

This all works fine, I have a separate page that lets you upload the picture on the server in the /images folder, and everytime a client wants to put a new picture up on the image wall, I have to add another line of code in the html file of the image viewer to show this.

Basically, my image viewer page will look like this in the part that displays the pictures:

<img src="../images/image1.jpg"><span>image1description</span>

开发者_StackOverflow<img src="../images/image2.jpg"><span>image2description</span>

<img src="../images/image3.jpg"><span>image3description</span>

<img src="../images/image4.jpg"><span>image4description</span>

...and so on.

The Problem

I want to make this easy to use for anyone who wants to upload the pictures. Having to individually type up each line of code in the html file is risky: Having anyone have to log into the server and edit an HTML file has a big possibility for breaking the code and messing up the page. I want this to be automatic: A user should be able to go to the upload page, upload the picture, and the image viewer should have that line of code accessible so basically it is an easy to use front-end. Also it is time consuming, there has to be a way for this to happen automatically.

Possible Solution

I'm thinking that the best way to do this is by, when the client uses the uploader to upload the file to the server, the uploader will also add a line into another file, so that the file is just a list of images with the format:

<img src="../images/image1.jpg"><span>image1description</span>

<img src="../images/image2.jpg"><span>image2description</span>

<img src="../images/image3.jpg"><span>image3description</span>

<img src="../images/image4.jpg"><span>image4description</span>

I want to do this and have the image viewer include the code in the file that is the list of images, but I dont know how to do it. What is the best way for this to work?

I am somewhat new to HTML and web design, so if there is any easier ways to do this, please let me know.


If I get it right you want to upload images and add them into html dynamically without editing the html? If that is the case then you have to add an upload section for your images. You can find an upload example here : http://www.reconn.us/content/view/30/51/
You have to create a database where you will write the image name and then write a script that will read the database and loop through the result and printing the img tag on the html file that will be generated. I hope I helped.

Nick.

0

精彩评论

暂无评论...
验证码 换一张
取 消