cimage icon indicating copy to clipboard operation
cimage copied to clipboard

Allow regexp search and replace of image source

Open mosbth opened this issue 8 years ago • 0 comments

I got this as an email.

My question now lies around trying to call in images from a remote folder, such as an AWS S3 bucket, without using the full URL in the call

EG: imageserver.com?src=https://myremotefolder/image.jpg

Is there anyway to rewrite or hardcode the remote folder into the settings so that I could just call the image normally,

EG: imageserver.com?src=image.jpg

My thought behind this is if the server that is running this library becomes unusable for some reason, I could easily launch a new one with the same base code and then continue to server the images as they are on the server directly but in a remote folder/bucket.

My response was

I've been thinking about what you suggests. One way is to use rewrite rules in htaccess, but that would be a bit tricky, another way would be to allow for the user to apply a set of regexp on the &src and allowing for the regexp to be configurable in img_config.php.

imageserver.com?src=remote/image.jpg or image/remote/image.jpg (using standard cimage htaccess rewrite rules)

regexp find/replace on $src

#remote# #https://myremotefolder/#

could become

$src = https://myremotefolder/image.jpg

mosbth avatar Nov 10 '16 12:11 mosbth