Skip to content
Snippets Groups Projects
Select Git revision
  • 5ddb85b24417405b65b1661f9a1a0c4442043f41
  • main default protected
  • rewrite
  • production
4 results

image_grabber.php

Blame
  • image_grabber.php 462 B
    <?php
    
    if (array_key_exists(2, $uri)) {
        $avatar_links = db_execute('SELECT public FROM avatars WHERE id = ? LIMIT 1', [$uri[2]]);
    
        if (empty($avatar_links)) {
            $fp = fopen('./assets/default.png', 'rb');
        } else {
            $fp = fopen(DATA_LOCATION . $avatar_links['public'], 'rb');
        }
    
        header("Content-Type: image/png");
        header("Content-Length: " . filesize(DATA_LOCATION . $avatar_links['public']));
    
        fpassthru($fp);
        exit;
    }