I run a site called the Hatching Dragons and have a lot of people that use my site.
What I want to do is allow them to pull up an image from MY server (don't know how to do that either) let them edit it(by dragging images onto it) then save it. If they need to edit it I want them to be able to pull it up from some type of form and edit and save.
If anyone can help me on this I'd be very appreciative.
Thanks
RP
Saving images to database?
Moderator: General Moderators
- dragonsmistress
- Forum Commoner
- Posts: 44
- Joined: Thu Dec 18, 2008 2:03 pm
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Re: Saving images to database?
1. Upload the image using a form
2. Store the image in a DB field (type BLOB)
3. Create a proxy script which accesses the BLOB and echo's result to user agent
It's not hard but it's more work than just easily walking you through it.
Have you worked with a SQL database before? Do you know how to insert numbers and letters? BLOB data is no different.
A proxy script would look something like:
Then instead of accessing the images directly like when stored on file you would call the proxy script like:
2. Store the image in a DB field (type BLOB)
3. Create a proxy script which accesses the BLOB and echo's result to user agent
It's not hard but it's more work than just easily walking you through it.
Have you worked with a SQL database before? Do you know how to insert numbers and letters? BLOB data is no different.
A proxy script would look something like:
Code: Select all
<?php
$sql = "SELECT * FROM table WHERE pkid = 3";
$res = mysql_query($sql);
$row = mysql_fetch_object($res);
header('Content-TYpe: image/jpeg'); // Wrong but you get the point I hope
echo $row->rawdata;Code: Select all
<img src="proxy.php?pkid=3" />- dragonsmistress
- Forum Commoner
- Posts: 44
- Joined: Thu Dec 18, 2008 2:03 pm
Re: Saving images to database?
Yes, I have worked with them before... but none of what you wrote (most of it anyway) makes sense to me~
LOL... but yea I know how to insert stuff....
LOL... but yea I know how to insert stuff....
Re: Saving images to database?
Online image editing is quite tough. I'd suggest making your users download the image, edit it themselves, then re-upload it. For users that don't have image editing software, there are a few free, online image editors you could suggest.
Regardless of the image editing process, there's really no need to store the image data itself in the database. It is much more efficient to store the image in the filesystem, and just have the database keep track of the path to the file.
Regardless of the image editing process, there's really no need to store the image data itself in the database. It is much more efficient to store the image in the filesystem, and just have the database keep track of the path to the file.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.