0

I want to show an img like this:

http://picviewer.umov.me/Pic/GetImage?id=92013681&token=ee103380297bbb2df0d8855949d791df

How should i use php to show the img with dynamic parameters?

Ashish
  • 6,001
  • 2
  • 18
  • 18
Daniel
  • 111
  • 2
  • Possible duplicate of [How to display images from a folder using php - PHP](https://stackoverflow.com/questions/19129086/how-to-display-images-from-a-folder-using-php-php) – thecoolestguyever123 Aug 28 '18 at 16:08
  • i need without the file extension. like this example: http://picviewer.umov.me/Pic/GetImage?id=92013681&token=ee103380297bbb2df0d8855949d791df – Daniel Aug 28 '18 at 16:12
  • This is not a free code writing service. What did you try so far? Please [edit] your question and post your code as a [mcve]! What happened when you ran it? What did you expect to happen instead? What specifically are you having problems with? – Robert Aug 28 '18 at 17:17

2 Answers2

0

You need to set the proper content type headers and then stream the binary data.

$imagepath = '/path/to/file';

header("Content-type: image/jpeg");

echo file_get_contents( $imagepath );
BA_Webimax
  • 2,714
  • 1
  • 13
  • 15
0

First i'll explain what does that URL do: it's configured to point to a script, or class->function, that manages the searching in the database, for the real path, the path you want to hide for the user, then returns the image to the request.

That said, in two steps, what you have to do is the following.

  1. Check how to customize your url, this could be a start:

How to create friendly URL in php?

  1. create your custom url pointing to a script or class/function like this:

Return a PHP page as an image

Thats, all... Assuming that you already have the images/database covered of course. if not, well you'll have to make the necessary database and tables...

Erubiel
  • 2,934
  • 14
  • 32