we are using Amazon S3 for displaying images on our website. Right now, the images are saved with the keys:
myimages/193-image-small.jpg
myimages/193-image-large.jpg
myimages/194-image-small.jpg
myimages/194-image-large.jpg
and so on...
I can embed an image in my page with a code like this:
<img src="s3-zone.amazonaws.com/mybucket/myimages/193-image-large.jpg">
This is working nice and properly but I want to go a step further and display SEO friendly picture URLs for google like:
s3-zone.amazonaws.com/mybucket/myimages/193-super-great-title-for-my-picture.jpg
Is that in any way possible to implement and if yes - how?
This is not possible. Each object in Amazon S3 has one Key Name.
Some options:
Rename the objects to the name you desire, or
Point the URLs to your web server, which can translate the URL to the 'normal' URL and retrieve the underlying S3 object -- but this will put load on your web server rather than sending all requests to S3
If you want to be SEO-friendly, it's much better to add an alt field to the img tag. That counts more than filenames.
For example, see: How to Optimize Images for Better Search Engine Rankings
Related
I want to build a website/Web app that a company's employees will use to upload documents (PDFs, docx). They (employees) will enter the title of the document as well as tags. Members of the public can then go to a subdomain of the site & search for those documents so that they can view them in the browser or download them.
How do I do this? I'm assuming this is part of what's called document management; hence the title question of this post. Can WordPress or Joomla handle this? Is there a ready-made template that I can use?
I'm also undivided about where to store the uploaded documents. Should they be:
Stored in a database (MySQL or MS SQL) or
Stored in the file system of the web server or
Stored in cloud storage services like Google Drive, On Drive or DropBox?
If I use a database, will it be possible to use the traditional HTML file download method viz a href?
I look forward to your replies. Thanks.
You Can use WordPress using any theme you like with plugins like:
Forminator, WPForms, WP Extra File Types, and so on.
WordPress will have a fully built and ready-to-use database.
and also you can customize your frontend using plugins like elementor.
I hope you are all doing great. My question is
I am using cantaloupe image server which serves images according to user specify parameters in url using IIIF image API v2.0
Here is the url.
https://iiif.blavatnikarchive.org/iiif/2/baf__be12495f1d825e832cd7b66f0ee30c8adda804cd6c19e627537107b714b95356/full/!1000,1000/0/default.jpg (1000x1000 image)
https://iiif.blavatnikarchive.org/iiif/2/baf__be12495f1d825e832cd7b66f0ee30c8adda804cd6c19e627537107b714b95356/full/!512,512/0/default.jpg (512x512 image)
Image server takes time to process image for user defined dimensions and region extraction around 4sec. Therefore what i am doing is to pre generating some thumbnails using image server and storing them on amazon s3 so if user requests same thumbnail again and again I serve them pre generated thumbnail. Two benefits
1- Image server not computing it every time and load on server will be low.
2- Image serving through static thumb will be faster because it is pre generated.
Problem is now actually two servers are involved.
1- Image server for dynamic content creation. https://iiif.blavatnikarchive.org
2- Amazon s3 buckets for static thumbnails which were pre generated. assets.s3.amazonaws.com/image-name
I want to serve images using one url so end user don't redirect to different locations for same image with different sizes. So i decided to serve images using API
https://api.blavatnikarchive.org/baf__be12495f1d825e832cd7b66f0ee30c8adda804cd6c19e627537107b714b95356/full/!512,512/0/default.jpg (Apache using php)
In my api I know which request is for static thumbnail and i need to take it from s3 bucket and which one is for dynamic size and need to take it from image server. In API i need to get image using file_get_contents("url of image whether its amazon s3 url or image server url") so request downloads it first on my api server and then serve to client and client browser downloads it again which is time consuming and takes around 2s for one image which is not acceptable. Image serving time should be less than a sec. I am here to know is there a way to map my api url directly to image server and amazon server.
Like
If user type https://api.blavatnikarchive.org/baf__be12495f1d825e832cd7b66f0ee30c8adda804cd6c19e627537107b714b95356/full/!1000,1000/0/default.jpg
It should map to https://iiif.blavatnikarchive.org/iiif/2/baf__be12495f1d825e832cd7b66f0ee30c8adda804cd6c19e627537107b714b95356/full/!1000,1000/0/default.jpg (1000x1000 image)
Or specify
https://iiif.blavatnikarchive.org/iiif/2/baf__be12495f1d825e832cd7b66f0ee30c8adda804cd6c19e627537107b714b95356/full/!512,512/0/default.jpg (512x512 image)
Should map to directly static image thumb
https://baf-iiif-assets.s3.amazonaws.com/be12495f1d825e832cd7b66f0ee30c8adda804cd6c19e627537107b714b95356
or you can suggest me solution how i can gather things to one url? I want to keep user on my api url and dont want to use any redirection. How can i achieve this?
Many thanks.
I'm uploading images to s3, saving the absolute URLs in my database, and then displaying them in my frontend. There are two problems I see - the first one is that I need to mark them as public while uploading:
$path = $image->storeAs('folder', md5('file_name.jpg'), ['disk' => 's3']);
Storage::disk('s3')->setVisibility($path, 'public');
$url = Storage::disk('s3')->url($path);
The second problem is that the URLs I use in the website have the bucket name in it obviously, for example:
<img src="https://bucket-name-staging.s3.eu-central-1.amazonaws.com/folder/84b4b3j4j34j12j3123h21jh321k312312.jpg">
This also makes it blocked by adblock sometimes. Is this the recommended way to do it? Can I display images on the website if they are private in the s3 bucket? (I tried it - but that's a 403 response).
As for first question, please check the following approaches mentioned here:
Upload files Securely to AWS S3
Uploading Photos to Amazon S3 from a Browser
As for second problem, please check:
Route 53
CloudFront(is needed if you would like to load files by https)
If you are using pure HTML code to show the s3 images on your website there is no way else flagging them as public, but in this case, those files will be available for all people around the world and they can show your images and absolutely you will be charged or using signed url, but you are using PHP you can try this
I have thousands of images to display on browser form private bucket of S3.
What is best way to get these private file on browser.
In order to get private image from s3 I have found multiple solutions listed below:
Make the files public. (can't use this as per requirment)
Generate pre-signed urls for files.
Pulls the image via the API from S3, caches it and serves.
By changing bucket policy.
Currently I am using signed url to get images but for every image I have to generate signed url. it will take lot of processing time.
My Question is, what is best way? And how to achieve this?
Your method of using Pre-signed URLs is correct.
You should generate these URLs when serving the HTML page that contains the images. This can be done with a couple of lines of code, or the createPresignedRequest PHP call. (I'm not familiar with Laravel, but you tagged your question with PHP.)
Thus, the page will contain dynamic content, created for the user on-the-fly.
I want to output a file from Dropbox onto my website with Dropbox PHP Core SDK. To give an example, I upload an image to Dropbox. Now, how do I display that image to my website from Dropbox's servers. Keep in mind, I don't want to download this file from Dropbox and then display that image. Is it possible to display an image or another file directly from Dropbox using Dropbox PHP Core SDK?
EDIT:Would you mind being more clear on #1
How do I use the custom URL?
Can I do this: header("location: $url);
Is this how you use the custom url? Thanks!
Using the PHP Core SDK, the main way of accessing file content is using the getFile method, or for images where you don't need the full resolution, the getThumbnail method. However, these return the data directly, e.g., to save on your server and serve back to the user, so that doesn't suit your needs as described.
It sounds like you'd prefer the API to return a link to the image that you can use as the source for the images in the HTML of your page. The Dropbox API doesn't offer a method particularly well suited for that, but there are some non-ideal options:
1) You can use createTemporaryDirectLink to get a direct URL to the image. Note that these links expire after four hours though.
Using it would look like:
list($url, $expires) = $client->createTemporaryDirectLink("/default.png");
2) You can use createShareableLink to get a preview URL for the image. These links don't expire. Note that these don't link directly to the image data though, so you'd need to modify them as documented in this help article.
Using it would look like:
$url = $client->createShareableLink("/default.png");
Also, not that both of these are subject to bandwidth restrictions, per this help article.