• puggan

    (@puggan)


    what filter should i use in an addon, to catch permalinks thats starts whit “/image/”.

    When the user visit an link that starts whit “/image/”, i want to send the mimetype and content of that file, insted of showing a html-page.

    i could do “/image.php?image_id=1”, but i prefer “/image/1”

Viewing 1 replies (of 1 total)
  • Thread Starter puggan

    (@puggan)

    i don’t know if this is the right way, but i solved it
    in the filter: “parse_request”.

    if($wp->query_vars[‘name’] == ‘image’)
    {
    $imageID = (int) trim($wp->query_vars[‘page’], ‘/’);
    $picture = nggdb::find_image($imageID);
    $file = $picture->imagePath;
    $mime = mime_content_type($file);
    header(“Content-type: {$mime}”);
    die(file_get_contents($file));
    }

    the parameters name and page works, but sounds bad.

    Any one got a better way to solve this?

Viewing 1 replies (of 1 total)
  • The topic ‘permalinks to images’ is closed to new replies.