Simple Image Stack Website using PHP and API


This project is titled Simple Image Stack Website. The web application enables visitors to explore multiple images. Its primary purpose is to serve as a reference or guide for students and beginners on Integrating PHP and API. The application boasts a straightforward and appealing user interface, coupled with user-friendly features and functionalities.

How does this Image Stack Website work?

The Image Stack Website utilizes the Pexels API. Visitors can explore a variety of images on the site. Each page showcases 40 images based on the keyword entered into the search box. The search functionality allows users to filter images relevant to the provided keyword. Additionally, users can preview an image by clicking on it, triggering a popup modal that displays the photographer's name, download buttons for different image sizes, and a larger preview of the image itself.

Features and Functionalities

The application boasts the following features and functionalities:

  • Display a Collection of Stacked Images
  • Pagination
  • Searchbox
  • Preview Modal
  • Display Details
  • Listing Image Available Sizes Download Links


The project utilizes various technologies for its development:

  • PHP
  • Pexels API []
  • HTML
  • CSS
  • Bootstrap Framework
  • jQuery Library


Explore some snapshots of this Image Stack Website Project:

Home Page

Image Stack Website using PHP and Pexels API

Preview Modal

Image Stack Website using PHP and Pexels API

The complete source code zip file for this tutorial is available on this website, and it's free to download. Feel free to download and customize it according to your preferences, enhancing your programming knowledge and capabilities. Locate the download button below in this article's content.

How to Run?


  • Download and Install any local web server such as XAMPP.
  • Download the provided source code zip file. (download button is located below)

Generate Pexel API Key

  1. Login or Register on
  2. Upon successful login, click the user avatar icon in the navigation bar. From the dropdown menu, select `Image and Video API`.
    Image Stack Website using PHP and Pexels API
  3. Click the `Your API Key` button to generate your API key.
    Image Stack Website using PHP and Pexels API
  4. Save the API key

System Installation/Setup

  1. Open your XAMPP Control Panel and start Apache.
  2. Extract the downloaded source code zip file.
  3. Copy the extracted source code folder and paste it into the XAMPP's "htdocs" directory.
  4. Browse the PHPMyAdmin in a browser. i.e. http://localhost/phpmyadmin
  5. Locate and Open the `stackAPI.class.php` file with your preferred code editor.
  6. Replace the `$this->apiKey` value with you Pexels API Key and save it.
  7. Browse the Simple Image Stack Website in a browser. i.e. http://localhost/php-image-stack/.

And there you have it! I trust that this Simple Image Stack Website Source Code, developed using PHP and Pexels API, proves beneficial for your needs and provides valuable insights for your future PHP projects. Delve deeper into this website for a multitude of Free Source Codes, Tutorials, and Articles spanning various programming languages.

Consider exploring the following as well:

Happy Coding =)

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.


1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.


Submitted byoleteacheron Wed, 12/06/2023 - 06:54

Nice tutorial. How about searching for videos? Be nice to have dual action to search for images and/or videos.

Add new comment