ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I wanted to Know any MySQL command that I can use to insert an image file as it is in a certain field in a database. I've heard that the blob field can store images but i don't know how to add the images and to retrieve them! All the codes I've seen up to now are in PHP which I don't understand!! I am using Java to serve as platform to view and save the images!. Any help would be greatly appreciated !
the best way is just to store the location of the file in a varchar or text or something like that, and then just retrieve it with whatever language you are using
Yeah I know about that but thats not possible with the app am just doing. In this app, there are multiple computers each having a database for them. The data for each computer are then centralised to a server in another place and then redistributed. Its a sort of Distributed System. This the method of keeping path that process becomes very lenthly and I think that saving the images in the database itself is the best way! So if anyone could tell me how that can be done it would be just great! I know it can be done as I've seen it being done and I've also seen it in the MySQL Documentation... Its just that I Don't know how to do that!! Help Please!!!!
It's whatever you want it to be. In our case, we're:
a) The script is in PHP
b) It generates a random number between 1 and [max image id]
c) It does a PHP/mySql "select image_location,alt_image where image_id=id;"
d) It writes out "<img src=\"$image_location\" alt=\"$alt_image />
So in our case, it's a path relative to the web root.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.