I\'m looking for a method that encodes an string to shortest possible length and lets it be decodable (pure PHP, no SQL). I have working sc
Instead of encoding the url, how about outputting a thumbnail copy of the original image? Here's what I'm thinking:
1) Create a "map" for php by naming your pictures (the actual file names) using random characters. Random_bytes is a great place to start.
2) Embed the desired resolution within the randomized url string from #1.
3) Use the imagecopyresampled function to copy the original image into the resolution you would like to output before outputting it out to the client's device.
So for example:
1 - Filename example (from bin2hex(random_bytes(6))
): a1492fdbdcf2.jpg
2 - Resolution desired: 800x600. My new link could look like:
http://myserver.com/?800a1492fdbdcf2600
or maybe http://myserfer.com/?a1492800fdbdc600f2
or maybe even http://myserver.com/?800a1492fdbdcf2=600
depending on where I choose to embed the resolution within the link
3 - PHP would know that the file name is a1492fdbdcf2.jpg, grab it, use the imagecopyresampled to copy to the resolution you want, and output it.