I have some files they are stored in mysql database as Blob(Binary large object). I want to create thumbnail for those files. But for thumbnail one must have url of the resource. I don't have the url because my data is stored in database.
I know one solution that instead of storing data in mysql database I can store in AWS s3 bucket and from there I can get one public url and I can use that for creating thumbnail.
Is there any way to get the url If the data is stored in database?
as your data is stored in database, you will need to write it to disk first and then you can use its path for further use...
another approach would be to create thumbnail at the time of storage and copy it to a location, that way you can access the thumbnail whenever required. But you will need mapping of file vs its thumbnail...
Related
Inside ADF I'm trying to get the ready-made contents of a query for a GraphQL API (Web activity block) stored in a JSON somewhere in the blob. Because of speed requirements, we can't afford to just spin up Databricks every single time.
What can be done to get the content, not metadata of a JSON file and store it inside a ADF variable that would parametrize further pipeline blocks (the path to the file is known, fixed, and the file is accessible via a linked service)?
I would go with creating meta data Azure SQL database (basic cost only 5 usd per month). It can be connected via private link with Azure Data Factory. This is simplest and fastest way. You just save data there and later fill dataflow etc. parameters with results from that database.
I have got access token and expiry time as two columns in a JSON file after doing a POST request and stored the file in Blob storage.
Now I need to look inside the JSON file the I stored before and take the value of Access token and use it as a parameter to another REST request.
Please help...
Depending on your scenario, there are a couple ways you can do this. I assume that you need the access token for a completely different pipeline since you are storing the Get access token output to a file in Blob.
So in order to reference the values within the json Blob file, you can just use a lookup activity in Azure Data Factory. Within this Lookup Activity you will use a dataset for a json file referencing a linked service connection to your Azure Blob Storage.
Here is an illustration with a json file in my Blob container:
The above screenshot uses a lookup using the Json File dataset on a Blob Storage Linked service to get the contents of the file. It then saves the outputted contents of the file to variables, one for access token, and another for expiration time. You don't have to save them to variables, and instead can call the output of the activity directly in the subsequent web activity. Here are the details of the outputs and settings:
Hopefully this helps, and let me know if you need clarification on anything.
EDIT:
I forgot to mention, if you need to get the access token using a web activity, then just need to use it again for another web activity in the same pipeline, then you can just get the AccessToken Value in the first web activity, and call that output in the next web activity. Just like I showed in the Lookup Activity, but instead you'd be using the response from the first web activity that retrieves the Access Token. Apologies if that's hard to follow, so here is an illustration of what I mean:
A simple way to read JSON files into a pipeline is to use the Lookup activity.
Here is a test JSON file loaded into Blob Storage in a container named json:
Create a JSON Dataset that just points to the container, you won't need to configure or parameterize the Folder or file name values, although you certainly can if that suits your purpose:
Use a Lookup activity that references the Dataset. Populate the Wildcard folder and file name fields. [This example leaves the "Wildcard folder path" blank, because the file is in the container root.] To read a single JSON file, leave "First row only" checked.
This will load the file contents into the Lookup Activity's output:
The Lookup activity's output.firstRow property will become your JSON root. Process the object as you would any other JSON structure:
NOTE: the Lookup activity has a limit of 5,000 rows and 4MB.
How can I insert an image data in MySQL Database and then retrieve it using Golang?
Basically I want that task for upload profile picture of user in web application.
According to the my knowledge,the best solution is save image as blob object in database.Is it best solution for upload image in webapplication in golang.?
Please help me find the best solution for that.I want to find the solution in golang.I am beginner for golang programming.
converting image to a blob and save it in the database is a somewhat long process and it may cause issues sometimes. The easiest way is saving the image to a server (or a local directory) and saving the image path in the database. In that way we can access the image by using the image path in the database. This, will show how to save image path and access it and converting image to a blob and save it in the database.
Here
Actually I have to upload 20000 images into mysql database if I store all images to Mysql database as Blob type the performance is reduced and It will slow down if we upload other images if required.To avoid this problem I am storing all images into folder and their path's into mysql database table.and retriving these images with pagination .
now data is showing in table but images are not displaying.
String sb1 = new String("file://");
String sb2=new String(user.getPlaceImage());
out.println("<td><img src="+sb1.concat(sb2)+" width='70' height='50' /></td>");
If there is any alternative way to deal with this problem?
Here is a basic alternative technique that I use to serve images to users:
Create a folder outside your website root so users won't have direct access to the files using HTTP. Let's say you already have a database table that contains URI to all the images. Create a interface file, for instance: getimage.jsp?id=42 that serves user the requested image file. Also, if you are storing relative URLs in the database you need to be extra careful because you might be trying to read the file from a wrong path in relation to your JSP file that's trying to access the image.
I would like to store images in my mySQL database using the CodeIgniter PHP framework.
How do I write and read the image?
Thank you.
You will have to use the file uploading class of CI to upload the files and use the models to save them to the database, here are related resources:
File Uploading Class
Models
It's considered bad practice to store the actual image files directly in a database. Instead you can just store a path to the file in the database and store the file in a directory on the server.
AstaHost Forums
Best approach for storing uploaded image
CodeIgniter - Uploading an Image through a form, store the location of the image in database