I'm trying to store images as BLOBs in my database. I know this isn't the optimal solution but it'll have to do for now as it is a small database. When I upload the photo it takes up way too much space as shown and is cut in half. Is there a way to resize it into a thumbnail. I don't have access to any html pages and only limited access to php files. I can only manipulate the database. Any help would be appreciated.
Asked
Active
Viewed 453 times
0

ybce
- 176
- 4
- 17
-
1Show us the code or it didn't happen – Xorifelse May 26 '16 at 13:54
-
Might be useful to add some code to this question – ChrisBint May 26 '16 at 13:55
-
What kind of code would like to see? As I said I have very little access to code in this situation. I have to use a PHP generator which generates all the code for me and generates html too. I can only view html code by viewing the source of the page. – ybce May 26 '16 at 13:59
-
*"it takes up way too much space as shown and is cut in half"* - That's because BLOB is too small. You need to either use MEDIUMBLOB or LONGBLOB. And yes, there is a way to resize them before uploading. You can easily find that in a search. – Funk Forty Niner May 26 '16 at 14:03
-
@Fred-ii- I'm using a LONGBLOB – ybce May 26 '16 at 14:10
1 Answers
0
Yu can have look at THIS LINK
But it is rather good to save Image in Folder And Creating link for it and insert it is database...
e.g.
$fileName = $_FILES["image"]["name"];
$fileNameNew = preg_replace('/\s+/', '_', $fileName);
$fileTmpLoc = $_FILES["image"]["tmp_name"];
// Path and file name
$pathAndName = "My-Image-Folder/".$fileNameNew;
// Run the move_uploaded_file() function here
$moveResult = move_uploaded_file($fileTmpLoc, $pathAndName);
// Evaluate the value returned from the function if needed
And Then Add $pathAndName
in database...

Community
- 1
- 1

Dr Manish Lataa-Manohar Joshi
- 2,380
- 5
- 17
- 38