quasiman Posted August 6, 2009 Share Posted August 6, 2009 Hello all, I'm using Joomla's Virtuemart component, and I need to thumbnail all of the product images. I have a script that does this part perfectly, but of course I have to also update the database to know which images to use. I'm not getting any errors, in fact my results say successful....but then I look in phpMyAdmin and nothing has changed. Below is my script, please take a look and let me know what I'm missing. Thanks! <?php ini_set('display_errors', 1); ini_set('log_errors', 1); ini_set('error_log', dirname(__FILE__) . '/error_log.txt'); error_reporting(E_ALL); include ('/outsidewebroot/dbconnect.php'); $linkID = mysql_connect($host, $user, $pass) or die("Could not connect to host."); mysql_select_db($dbase, $linkID) or die('Error: ' . mysql_error()); //Open images directory $dir = opendir("components/com_virtuemart/shop_image/product"); //List files in images directory while (false !== ($file = readdir($dir))) { if ($file != "." && $file != ".." && $file != "index.html" && $file != "resized") { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "thumb.php?src=".$file."&dest=tn_".$file."&x=90&y=90"); curl_setopt($ch, CURLOPT_HEADER, 0); curl_exec($ch); curl_close($ch); $resizedfile = "resized/tn_".$file; $update = 'UPDATE jos_vm_product SET product_thumb_image = "$resizedfile" WHERE product_full_image ="$file"'; if (!mysql_query($update,$linkID)) { die('Error: ' . mysql_error()); } echo "1 record added"; echo $resizedfile."<br>"; } } closedir($dir); mysql_close($linkID) ?> Link to comment https://forums.phpfreaks.com/topic/169150-solved-create-thumb-image-update-mysql/ Share on other sites More sharing options...
abazoskib Posted August 6, 2009 Share Posted August 6, 2009 why dont you do a mysql_query on its own, outside of that 'if' statement you have. Link to comment https://forums.phpfreaks.com/topic/169150-solved-create-thumb-image-update-mysql/#findComment-892530 Share on other sites More sharing options...
quasiman Posted August 6, 2009 Author Share Posted August 6, 2009 Nevermind, I fixed it $update = "UPDATE jos_vm_product SET product_thumb_image = CONCAT('resized/tn_', product_full_image)"; Link to comment https://forums.phpfreaks.com/topic/169150-solved-create-thumb-image-update-mysql/#findComment-892535 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.