How do I insert images into MYSQL is this possible?

Hello, Is it possible to create a table and then insert my images into it? If not, were do I physically go to insert them at? In Joomla? Thanks!!!

I'm trying to create a database driven site and I need to have the images there..can I do this? Thanks :)

Im new to this , please help and explain !!

Comments

  • Here is a list of the data types that are available within MySQL.

    There is no mention of images. So the best you can do is to store the image name.

    As to where you actually store the image, well that depends on what you are doing.

    Usually you would store the images in a directory on the server that contains the database.

    Have fun.

  • Take a look at http://www.phpriot.com/articles/images-in-mysql

    But, the way I do it is to upload the image and change the name on the server. I can then store the image name in the database using the scripting language eg PHP, then create the HTML to link to the file dynamically.

  • Store the image's binary data.

    If your using VB:

    System.IO.MemoryStream()

    And Java use:

    java.awt.image.PixelGrabber

  • Yes, you need to create a BLOB and learn how to use into that datatype.

  • Check out this tutorial. It covers two ways of saving images into a mysql database.

    http://mrarrowhead.com/index.php?page=store_images...

    $handle = fopen("testpic.jpg", "rb");

    $img = fread($handle, filesize('testpic.jpg'));

    fclose($handle);

    //die($img);

    $img = base64_encode($img);

    database_connect

    ('localhost', 'root', 'admin', 'img_test', &$db_selected, &$connection);

    $sql = "insert into pictures values(null,'$img','jpg','female')";

    mysql_query($sql) or die('Bad Query at 12');

    echo "Success! You have inserted your picture!";

  • importing records The <enter> type record will modern-day a sparkling container and a "browse" button. Clicking the browse button will enable the consumer to opt for a record to function. Clicking the submit will submit the type to this comparable record. Your "upfiles.Hypertext Preprocessor": <header> <?Hypertext Preprocessor function UploadOne($fname) { $uploaddir = 'uploadedfiles/'; if (is_uploaded_file($fname['tmp_name'])) { $filname = basename($fname['call']); $uploadfile = $uploaddir . basename($fname['call']); if (move_uploaded_file ($fname['tmp_name'], $uploadfile)) $res = "record " . $filname . " replaced into effectively uploaded and stored.<br>"; else $res = "could not pass ".$fname['tmp_name']." to ".$uploadfile."<br>"; } else $res = "record ".$fname['call']." did not upload."; return ($res); } ?> </header> <physique> <?Hypertext Preprocessor if ($_FILES['image']['call'] != "") { $res = UploadOne($_FILES['image']); $filname = $_FILES['image']['call']; echo ($res); } ?> <h1>importing records</h1> <type call="fupload" enctype="multipart/type-archives" action="upfiles.Hypertext Preprocessor" technique="submit"> <enter type="record" call="image" /> <enter type="submit" fee="submit" /> </type> </physique> finally: you may create a itemizing the place to place the uploaded records, and that itemizing could have permissions set to 0777... (right here called "uploadedfiles") (This set of applications works, yet isn't shield against viruses or "injection": the prevention of those is a much extra complicated remember!)

Sign In or Register to comment.