I want to save the pictures (jpg files) in the database and i want to view that pictures using php. please help me. what is the code for that?
I want to save the pictures (jpg files) in the database and i want to view that pictures using php. please help me. what is the code for that?
It's exactly the same as reading/writing anything else to/from a database. Make sure, though, that the row/column* you're writing it into allows binary input. In MySQL, this means it needs to be of the BLOB type with its BINARY attribute set.
Then, just store/retrieve it normally, and use a header("Content-Type: image/jpeg"); statement to set the MIME-type correctly before echoing the data to the browser.
* preferred visualisation varies depending on database package.
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
not to drag this off topic, but a quick question about the MIME-type command...
I saw that as an example for a page that was a php-generated image... and it's url was .../image.php, but it was just like a .jpg viewed as its own page.
Would you still need to include the MIME-type command if you were using the image in a page, such as the <img ...> command?
I might be missing something.
Yes. The user agent will (or at least should) depend upon the Content-Type HTTP header to determine how to handle a file. An accurate Content-Type header should be sent with every HTTP response that contains an entity body (returned content).Originally Posted by djr33
Mike
I solved that problem.
Another problem If I clike a button i want to view the data in another page.
(only using php)
Huh? Not too clear.
<form action='OTHERPAGE'>
<input type='submit'>
</form>
That would work. Put it inside an echo tag if you need it to be displayed by php.
...
echo "[insert above code]";
...
code is ok. But i want to pass a value to other page.
eg:- ______ search.
here i want to give a value (eg: name) for search & view the details of that data(eg:- age, firstname, lastname, etc...) another page using php.
On the PHP page, retrieve the value usingCode:<form action='OTHERPAGE' method="post"> <input type="text" name="search"> <input type='submit' value="Search"> </form>PHP Code:$_POST['search']
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
I want to insert a picture inside the php code.
echo(" <tr> <td height=\"17\"><img src=\"a.jpg\" width=\"748\" height=\"20\"></td> </tr>");
is it correct?
But it is not working. why?
You don't insert a picture into PHP code; you cause PHP to output the HTML to display the picture.
That is correct. Is the code being called?
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
Bookmarks