-2

Help with html-based site

Hi

I have a problem and would love some help!
I'm creating a site that displays pictures and an excel file. Both the picture and file have the same name and are located in a folder. So the html is calling on them both and then displaying on the site. To access the site you simply press the .html file.

All of it is written in HTML and CSS and it's located offline on a computer so we are a few people with access. Now to the problem. To add more pictures or to remove pics you have to edit the html-file code. And that is really difficult for some people. I need an easy way to add more images and files that will be displayed.

I have no server to work with. I know it would be much easier in PHP and store everything on a server but no. So if you have a solution for adding more pictures to the html without doing it in the code, maybe by a simple form. Please let me know!!

  • 2
    welcome to stack overflow mandelmassa, you are asking us to give you an idea or the whole implementation of an idea without sharing your own code. You are recommended to provide the details of your code and then ask for help. please refer to [this line](https://stackoverflow.com/help/how-to-ask) in order to improved your question. – Naser.Sadeghi Aug 31 '20 at 10:48
  • There isn’t much you can do here, without _any_ server-side technique. – CBroe Aug 31 '20 at 11:26

1 Answers1

1

Well, the best way to make this easier is to use PHP.

Method one build a simple upload form with PHP and HTML using XAMPP or MAMP as your local server.

Method two (same PHP) Create a folder with all your images and then use this simple script to call all the images from the folder.

<?php 
      $dirname = "/image_directory";
      $images = glob($dirname."*.jpg");

      foreach ($images as $image) 
        {
          echo "<img class='img-fluid' src='$image'>";
        }
  ?>

Now from the script above "/image_directory" is your image folder directory, "*.jpg" basically is calling all images with the ".jpg" extension. You can add more extensions if you want. So all your friends have to do is add the images into the folder directly and the script will automatically add to your page.

Since PHP is a server side language, you'll have to install XAMPP or MAMP and open your HTML page from localhost. i hope you get the whole concept.

G3rr0n
  • 76
  • 5