shadiadiph Posted December 23, 2008 Share Posted December 23, 2008 any ideas as to why this isn't working? imagecopyresampled($tmp, $src, 0, 0, 0, 0, $widthr, $heightr, $width_orig, $height_orig); imagejpeg($tmp, "test.jpg", 100); //imagejpeg($resampled, $fileName, $quality); $instr = fopen("test.jpg","rb"); $image = addslashes(fread($instr,filesize("test.jpg"))); mysql_query("UPDATE `upload` SET `thumbnail`= ( \"".$image."\") WHERE `intProductID`= '$adid' "); Link to comment https://forums.phpfreaks.com/topic/138155-solved-writing-temporary-image-to-database-not-working/ Share on other sites More sharing options...
ILMV Posted December 23, 2008 Share Posted December 23, 2008 Any error messages? codes? Explain a bit more... Happy Xmas! ILMV Link to comment https://forums.phpfreaks.com/topic/138155-solved-writing-temporary-image-to-database-not-working/#findComment-722157 Share on other sites More sharing options...
Yesideez Posted December 23, 2008 Share Posted December 23, 2008 addslashes() isn't binary safe - use mysql_real_escape_string() instead. http://www.php.net/mysql_real_escape_string Link to comment https://forums.phpfreaks.com/topic/138155-solved-writing-temporary-image-to-database-not-working/#findComment-722165 Share on other sites More sharing options...
shadiadiph Posted December 23, 2008 Author Share Posted December 23, 2008 mm i just changed addslashes to mysql_real_escape_string() and immediately started getting the error message Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/hmtcompa/public_html/user/submitad.php on line 118 Parse error: syntax error, unexpected T_STRING in /home/hmtcompa/public_html/user/submitad.php on line 118 with addslashes there were no error messages it just wasn't writing to the database. I have the column thumbnail set as a longblob that is correct right? Link to comment https://forums.phpfreaks.com/topic/138155-solved-writing-temporary-image-to-database-not-working/#findComment-722182 Share on other sites More sharing options...
ILMV Posted December 23, 2008 Share Posted December 23, 2008 Don't worry that you are getting error messages, that just means its trying to do something. Sometimes you will have one problem, and will have to solve 20 other errors before you are completely sorted. Link to comment https://forums.phpfreaks.com/topic/138155-solved-writing-temporary-image-to-database-not-working/#findComment-722225 Share on other sites More sharing options...
shadiadiph Posted December 23, 2008 Author Share Posted December 23, 2008 solved it Link to comment https://forums.phpfreaks.com/topic/138155-solved-writing-temporary-image-to-database-not-working/#findComment-722226 Share on other sites More sharing options...
ILMV Posted December 23, 2008 Share Posted December 23, 2008 Did you want to explain how you solved it? Would be good for all to know, especially those who search and find this topic. Happy Xmas! ILMV Link to comment https://forums.phpfreaks.com/topic/138155-solved-writing-temporary-image-to-database-not-working/#findComment-722227 Share on other sites More sharing options...
shadiadiph Posted December 23, 2008 Author Share Posted December 23, 2008 mm quite embarassing actually lol i have been awake for 20 hours+ doing this today mm the problem was the name of the column i was calling setting the data to it was called uploads not upload it actually works fine as it was. I figured this out when i tried to just set it as something simple and it didnt work. Link to comment https://forums.phpfreaks.com/topic/138155-solved-writing-temporary-image-to-database-not-working/#findComment-722239 Share on other sites More sharing options...
Yesideez Posted December 23, 2008 Share Posted December 23, 2008 lol we've all been there. Quite often it's the silly little things like this that can cause the most frustration! Link to comment https://forums.phpfreaks.com/topic/138155-solved-writing-temporary-image-to-database-not-working/#findComment-722240 Share on other sites More sharing options...
ILMV Posted December 23, 2008 Share Posted December 23, 2008 haha, its Christmas! Use that as an excuse. Now go to sleep Link to comment https://forums.phpfreaks.com/topic/138155-solved-writing-temporary-image-to-database-not-working/#findComment-722241 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.