+ 1

How do I get an image as output through get params?

I've been making a members registration system with profiles and want to get their avatars from a single file (like "/img/avatars?id=10005860538397&size=250x250"), is it possible to get different images? I've thinked of using PHP function to pickup an image from the folder like (/img/users/avatars/1000586053897.png) but it'll output the HTML markup. Is there any way to get the (image)?

29th Jul 2017, 2:50 PM
Azzaz Khan
Azzaz Khan - avatar
2 Réponses
0
The simplest way of achieving this is to use the .htaccess apache configuration file and generate a virtual URL for the file. The URL should be like /avatars/100005860538397 The would fetch the 100005860538397.jpg file and attach it to the passed virtual URL using the mod_rewrite Apache module.
12th Jun 2019, 8:33 PM
Azzaz Khan
Azzaz Khan - avatar
+ 3
I've thinked that first getting the image and encoding it into base64 then outputing it onto the avatars.php. Will it work? As the code is in another file instead of in src attribute?
29th Jul 2017, 2:54 PM
Azzaz Khan
Azzaz Khan - avatar