jaumerrr Posted March 25, 2010 Share Posted March 25, 2010 I have a problem and I am stuck with prestashop ... I can't add any image to any product. Here in this post I explain it all: http://www.prestashop.com/forums/viewthread/45461/general_discussion/cant_add_images_to_productsAs i can't get any help I would like to investigate even a lot more and know why I am getting this random nasty error.Can someone explain me what does this function do?It's in file /admindirectory/tabs/AdminProducts.phpSnippet I am interested becuase I am allways getting this error no matter what .. .I wan't to know why I allways get the " error while creating additional image " if (!sizeof($this->_errors)) { if (!$image->add()) $this->_errors[] = Tools::displayError('error while creating additional image'); else $this->copyImage($product->id, $image->id, $method); } Whole section /* Adding a new product image */ elseif (isset($_FILES['image_product']['tmp_name']) AND $_FILES['image_product']['tmp_name'] != NULL) { if (!Validate::isLoadedObject($product)) $this->_errors[] = Tools::displayError('cannot add image because product add failed'); else { $image = new Image(); $image->id_product = intval($product->id); $_POST['id_product'] = $image->id_product; $image->position = Image::getHighestPosition($product->id) + 1; if (($cover = Tools::getValue('cover')) == 1) Image::deleteCover($product->id); $image->cover = !$cover ? !sizeof($product->getImages(Configuration::get('PS_LANG_DEFAULT'))) : true; $this->validateRules('Image', 'image'); $this->copyFromPost($image, 'image'); if (!sizeof($this->_errors)) { if (!$image->add()) $this->_errors[] = Tools::displayError('error while creating additional image'); else $this->copyImage($product->id, $image->id, $method); } } $id_image = $image->id; } if (isset($image) AND Validate::isLoadedObject($image) AND !file_exists(_PS_IMG_DIR_.'p/'.$image->id_product.'-'.$image->id.'.jpg')) $image->delete(); if (sizeof($this->_errors)) return false; @unlink(dirname(__FILE__).'/../../img/tmp/product_'.$product->id.'.jpg'); @unlink(dirname(__FILE__).'/../../img/tmp/product_mini_'.$product->id.'.jpg'); return ((isset($id_image) AND is_int($id_image) AND $id_image) ? $id_image : true); } Link to comment Share on other sites More sharing options...
Martin Velikov Posted March 25, 2010 Share Posted March 25, 2010 You might want to check whether the folder where images are being uploaded is writable. Try settings all folders permissions to 755 and check whether this resolved the issue. Hope it helps. Link to comment Share on other sites More sharing options...
jaumerrr Posted March 25, 2010 Author Share Posted March 25, 2010 You might want to check whether the folder where images are being uploaded is writable. Try settings all folders permissions to 755 and check whether this resolved the issue. Hope it helps. It's not a permissions problem. I have resetted permissions many times, changed, etc ... makes no difference. Link to comment Share on other sites More sharing options...
Martin Velikov Posted March 25, 2010 Share Posted March 25, 2010 In this case you might want to check your php_errorlog for error messages when trying to upload the images. Link to comment Share on other sites More sharing options...
jaumerrr Posted March 25, 2010 Author Share Posted March 25, 2010 As i explained in the other post, there are no log errors at all, just this prestashop error. I have php in the most detailed verbose method for errors, and no errors printed on screen or in any log ... its confusing, I just get the prestashop error about additional image ... that's why i want to nail what the hell does this function check to show that error.If it were a server problem I would get an error log, but thios is a prestashop error that I can't get through.I will reinstall all again and it will work for some time, then it will block again!!! Link to comment Share on other sites More sharing options...
designguy79 Posted August 17, 2011 Share Posted August 17, 2011 Hello Jaumerrr, Were you able to solve the problem? I am having the exact same problem and cannot figure out how to get a more verbose error. I have tripled-checked the permissions and everything is fine. It was working just a few days ago and has mysteriously stopped. Thanks in advance! ~ Jeremy Link to comment Share on other sites More sharing options...
Pixelmio Posted January 23, 2012 Share Posted January 23, 2012 mee too :-( Link to comment Share on other sites More sharing options...
Magavenue Posted January 25, 2012 Share Posted January 25, 2012 Hi there, We got the same issue. The error thrown up because the table "ps_image_lang" is full. First it was suprising because the table was very light. It can happens with Innodb table. You can find a full report about this issue here : http://dev.mysql.com/doc/refman/5.0/en/full-table.html and the solution here : http://dev.mysql.com/doc/refman/5.0/en/innodb-data-log-reconfiguration.html Finally we resolved the issue by modifying the my.cnf file (Mysql configuration file) by editing the max limit of the innodb data file. Hope it can help you. Link to comment Share on other sites More sharing options...
SupaMonkey Posted January 27, 2012 Share Posted January 27, 2012 I had the same problem, but with only 9 images in my db i found it hard to believe i hit any limits. I opened up SQLYog, added an entry manually into image_lang table and then deleted it, went back to the back office and added the next image successfuly Link to comment Share on other sites More sharing options...
Lucas-911 Posted March 20, 2012 Share Posted March 20, 2012 I just changed the php memory limit in config.inc.php ini_set('memory_limit','128M'); Problem solved Link to comment Share on other sites More sharing options...
diamondgate Posted November 21, 2013 Share Posted November 21, 2013 this not problem of writing permission! I am looking for it. set ini_set('memory_limit','128M'); but it dose not help Link to comment Share on other sites More sharing options...
Brondo Posted September 7, 2015 Share Posted September 7, 2015 same problem here, when i want to add new image in product :" error while creating additional image " is there a solution ???!! Link to comment Share on other sites More sharing options...
HalKart Posted October 16, 2015 Share Posted October 16, 2015 I am Facing Same problem " error while creating additional image " . Please help me. Permission 755 php mode ON/OFF image format JPEG, size in kbs (30- 40 Kbs) every solution tried Link to comment Share on other sites More sharing options...
minnosh Posted October 16, 2015 Share Posted October 16, 2015 Bump. Same problem since attempted/failed upgrade from Prestashop 1.6.0.14 to 1.6.1. I turned on bug reporting (see 1st screenshot for how to instructions) and get "unexpected token <" there are few thread on the forum where others have experienced the same. Most seem to be suggesting checking permission files are 755 or 777 here's the thread that deals with that and php.ini settings: https://www.prestashop.com/forums/topic/302797-solved-error-uploading-products-images-in-ps-1561/?do=findComment&comment=1535934 This hasn't solved the problem for me though. Still looking. Link to comment Share on other sites More sharing options...
minnosh Posted October 16, 2015 Share Posted October 16, 2015 Erm.. and here's that screenshot of turning on error reporting: Link to comment Share on other sites More sharing options...
something394124 Posted November 3, 2015 Share Posted November 3, 2015 I think i have found the source to the problem, but not an fix! If you guys go to the 'ps_image' AND 'ps_image_shop' tables in you database, and look for rows where `cover` is set to 0 instead of NULL. If you change these rows to NULL, it will let you upload ONE more picture, but this picture will have a `cover` value of '0'... Can anyone understand why this happens? Or are all the `cover` values in 'ps_image' and 'ps_image_shop' supposed to be the value '0'? 2 Link to comment Share on other sites More sharing options...
jalloun Posted November 30, 2015 Share Posted November 30, 2015 (edited) this problem occured when we upgrade Prestashop or when we change the version manually. there are some differences between databases of some versions of prestashop. to solve this problem, and for example, let's say that we have upgraded Prestashop from 1.6.0.14 to 1.6.1.1: A ) export tables ps_image, ps_image_lang, ps_image_shop from database related to 1.6.0.14 B )delete or rename ps_image, ps_image_lang, ps_image_shop from database related to 1.6.1.1 C ) import tables exported before into database related to your new version (here 1.6.1.1) Hope this help you. Edited November 30, 2015 by jalloun (see edit history) Link to comment Share on other sites More sharing options...
Dasher3000 Posted December 17, 2015 Share Posted December 17, 2015 We have at least temporarily solved this by DROPping and editing INDEXes related to "cover" image. 1. We DROPped INDEX id_product_cover from ps_image indexes. 2. Also: we set to IGNORE the "cover" field of the INDEX id_image in the ps_image_shop table. This allowed us to upload, but I think you will need to recreate these indexes to get all the functionality to work. We noticed this created a bug (but it all works fine once you know the bug): 1. The "COVER" checkbox will DELETE that image -- so you can use it for that - Click SAVE and STAY to delete the selected image. 2. The LAST image you upload will be your COVER image. ** All your uploaded images will be marked "Cover" image... Hope that helps someone. - Dasher Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now