LoremFlickr

repository·master·Indexed 41 days ago

https://github.com/mastababa/loremflickr-2

A self-hosted placeholder image service that interfaces with the Flickr API to provide images of various subjects and sizes. Supports custom dimensions, keyword-based filtering (AND/OR logic), grayscale and color modes, and image locking via the lock parameter.

Tokens
685
Snippets
3
Records
5
Agent score
0%

What's inside LoremFlickr

  1. Display multiple different images on one page

    master

    Browsers may cache images when the same URL is requested multiple times on a single page, causing duplicate images to appear. To bypass this and ensure each request returns a different image, append a unique, meaningless query string to each URL.

    Example pattern:

    • https://your-website.com/320/240?random=1
    • https://your-website.com/320/240?random=2
    • https://your-website.com/320/240?random=3
    https://your-website.com/320/240?random=1
  2. Install LoremFlickr

    master

    To install LoremFlickr, follow these steps:

    1. Deploy Files: Place the project files in your desired directory.
    2. Configure API: Open config.php and enter your Flickr API and server details.
    3. Setup Cache: Adjust the cache locations in config.php and ensure the target folders are writable by the server.
    4. Add Dependency: Add Flickr.php from dopiaza's DPZFlickr into the includes folder.
    5. Configure Redirects: Depending on your installation path, update the .htaccess file to ensure redirects correctly point to image.php.
    6. Maintenance (Optional): Set up a cronjob to periodically clean the cache of old files.
  3. Use LoremFlickr to request placeholder images

    master

    LoremFlickr generates placeholder images via URL patterns. The basic structure is:

    https://your-website.com/{width}/{height}/{keywords}/{mode}

    URL Components

    • Dimensions: {width} and {height} (e.g., 320/240).
    • Keywords: Supports single keywords, multiple keywords (OR logic), or combined keywords (AND logic).
    • Color Mode: Use the prefix g/ for grayscale. Other available modes include p/ (presumably for a specific color or pattern), red, green, and blue.
    • Fallback: If no matching photos are found, the default image located in /assets is returned.
    https://your-website.com/320/240/paris,girl/all
  4. Request specific image types and keywords

    master

    Use the following URL patterns to control the content and color of your placeholder images:

    GoalURL Example
    Random image (default keyword 'kitten')https://your-website.com/320/240
    Specific keywordhttps://your-website.com/320/240/dog
    Grayscale image with keywordhttps://your-website.com/g/320/240/paris
    OR logic (matches brazil OR rio)https://your-website.com/320/240/brazil,rio
    AND logic (matches paris AND girl)https://your-website.com/320/240/paris,girl/all
    Grayscale with AND logichttps://your-website.com/g/320/240/paris,girl/all
  5. Lock an image using the `lock` parameter

    master

    To prevent the image from changing and force the same image to be returned (until the cache is updated), include the lock query string parameter with a positive integer value.

    https://your-website.com/320/240?lock=212

    https://your-website.com/320/240?lock=212