How to display image from database with Laravel and react hooks - laravel

I am new in reactjs I want to display image with Laravel and react hooks any easy way and fast to load image from Laravel path.?

there’s a lot of way to handle display image :
store your file path to db, so you can call your image using path
store you image to db using blob type (but i don’t recommend this approach because it will make your db size increases significantly)
you can store your image to aws / another cloud services
From my experience, it’s better to store path only into the database then store image file in your system. because it have better performance than store the image to db. the disadvantage using this approach is while you have to backup the images and db. or if you move the image manually, the path in db will not match with the actual image’s path. it will throw an error.
you can try using aws since aws give a free tier s3 storage.
For further information about use s3 storage, you can read Laravel documentation about the Filesystem for the technical use.

Related

SpringBoot: How to store image/video files when using on-prem

I have a spring boot application that receives data from user, the data contains images and videos.
I am a little skeptical about storing big files on database(MongoDb). As I can not use Amazon S3, what should I do to save images/videos ?
Should I save them in a folder in a docker on a VM? or
should I convert the image/video file to base64 and save it on MongoDb?
in case 1) is a good option, what should be my implementation approach? I am new to this,
i appreciate your comments.
I tried to save image/video files to database but it is extremely time consuming.

Heroku PlayFramework - create thumbnail

I already have PlayFramework app runing , but I am in process of migrating it to Heroku. Because on Heroku I can not use local filesystem like I did in my app. I am forced to use Amazon S3 ,but I do not know how to rewrite creating of thumbnails. For that I am using :
https://github.com/coobird/thumbnailator
Thumbnails.of(picture.getFile()).size(300,300).toFile(new File("public/images/data", thumb));
The problem is that I can not do this at heroku,because file wont be saved.
How do I create thumbnails then? If I do not want to use another service which will generate thumbnails for me and save them to s3 somehow...
Honestly if I would know how many different services would I need for simple page with java then I would stay at php forever...
In Heroku (as in many PaaS) there's no persistent filesystem. However, you do have access to temp directory.
So you could save it into a temp file
File temp = File.createTempFile("prefix", "suffix").getAbsolutePath;
Thumbnails.of(picture.getFile()).size(300,300).toFile(temp, thumb));
Then take that file and upload it to S3.
If you strictly insist on not using S3 for storing binary files, then you could base64 the file content and save it into the DB. (see some pros/cons for such approach here)

Store, fetch and map images from amazon webservice in MVC Dotnet Application

I'm new to Amazon webservice. I created a instance in AWS EC2 to publish my website.Now I have an requirement.
I have resources where each resource must be able to choose the images(as profile picture)during runtime. I want to fetch the images from amazon storage and map in the already developed mvc.net application. I had this idea of storing the images in amazonS3(via budget) but I need to know how to fetch them during run time which enables resources to choose their profile picture from the uploaded images in bucket.
Please letme know if there is anyother way to store and fetch profile pictures using amazon to my mvcdotnet application?
Store the Original Image file in S3 Standard option.Store the reproducible images like thumbs etc in the S3 Reduced Redundancy option (RRS) to save costs. Store the Meta data about images including the S3 URL mapping in Amazon RDS and query them whenever needed from EC2.

Where to store images in Amazon AWS for use in RDS

I am currently creating a bunch of tables on the MySQL service in Amazon RDS. Several of the tables need to have image links in them. What I am trying to figure out, is where do I put the images? Do they go in RDS somewhere? or do i put them in S3 and link them to RDS? If the latter, how do I do that?
I have googled the heck out of this, with no conclusion so any assistance would be great.
Depending on the image sizes, use cases, etc, I would probably store the images in S3.
You can store the S3 path as a database field. You can create a bucket as a domain name (ie, images.example.com), and point the CNAME to the bucket to get direct access to the images. You can also use the various S3 libraries to generate a time limited signed URL if you want to include security.
You can either store them just as binary-data in a column in RDS or you can use S3. If you use S3 you store the http-url to the image in RDS and then get the image over http from S3.

Storing images in file system, amazon-s3 datastores

There has been numerous discussions related to storing images (or binary data) in the database or file system (Refer: Storing Images in DB - Yea or Nay?)
We have decided to use the file system for storing images and relevant image specific metadata in the database itself in the short term and migrate to an amazon s3 based data store in the future. Note: the data store will be used to store user pictures, photos from group meetings ...
Are there any off the shelf java based open source frameworks which provide an abstraction to handle storage and retrieval via http for the above data stores. We wouldn't want to write any code related to admin tasks like backups, purging, maintenance.
Jets3t - http://jets3t.s3.amazonaws.com/index.html
We've used this and it works like a charm for S3.
I'm not sure I understand if you are looking for a framework that will work for both file-system storage and S3, but as unique as S3 is, I'm not sure that such a thing would exist. Obviously with S3, backups and maintenance are handled for you.

Resources