I'm looking to fetch images from my s3 bucket, using a key which I store in my DB.
I am currently fetching images using:
$img = "http://bucketname.s3.amazonaws.com/'.$imageKey.'";
Is this a wise way to do it or is there a better method?
The only downside I can see is that your $imageKey isn't saying which bucket the image is in.
One solution is to simply store the complete URL in your database, which is perfectly scalable.
Another solution is to add data to your $imageKey that you can use to identify which bucket the image is in.