gimmyp Posted January 12, 2015 Share Posted January 12, 2015 Hi, i've a problem with prestashop customization field upload because where customers upload there's image and click save the page refresh with a corrupt thumbnail link like as the screenshot below: When i click on this link and select "open image as a new tab" i see the following url and a 404 page: On my server (winserver2008r2) in the upload folder i find the file without extension. Where i can fix this problem? Thanks in advance Regards Link to comment Share on other sites More sharing options...
NemoPS Posted January 12, 2015 Share Posted January 12, 2015 Have a look at the pictureUpload() method of ProductController.php, check the filename over there and see if it's where your issue is Link to comment Share on other sites More sharing options...
gimmyp Posted January 12, 2015 Author Share Posted January 12, 2015 Hi, i've opened productcontroller.php and i've found following code: protected function pictureUpload() { if (!$field_ids = $this->product->getCustomizationFieldIds()) return false; $authorized_file_fields = array(); foreach ($field_ids as $field_id) if ($field_id['type'] == Product::CUSTOMIZE_FILE) $authorized_file_fields[(int)$field_id['id_customization_field']] = 'file'.(int)$field_id['id_customization_field']; $indexes = array_flip($authorized_file_fields); foreach ($_FILES as $field_name => $file) if (in_array($field_name, $authorized_file_fields) && isset($file['tmp_name']) && !empty($file['tmp_name'])) { $file_name = md5(uniqid(rand(), true)); if ($error = ImageManager::validateUpload($file, (int)Configuration::get('PS_PRODUCT_PICTURE_MAX_SIZE'))) $this->errors[] = $error; $product_picture_width = (int)Configuration::get('PS_PRODUCT_PICTURE_WIDTH'); $product_picture_height = (int)Configuration::get('PS_PRODUCT_PICTURE_HEIGHT'); $tmp_name = tempnam(_PS_TMP_IMG_DIR_, 'PS'); if ($error || (!$tmp_name || !move_uploaded_file($file['tmp_name'], $tmp_name))) return false; /* Original file */ if (!ImageManager::resize($tmp_name, _PS_UPLOAD_DIR_.$file_name)) $this->errors[] = Tools::displayError('An error occurred during the image upload process.'); /* A smaller one */ elseif (!ImageManager::resize($tmp_name, _PS_UPLOAD_DIR_.$file_name.'_small', $product_picture_width, $product_picture_height)) $this->errors[] = Tools::displayError('An error occurred during the image upload process.'); elseif (!chmod(_PS_UPLOAD_DIR_.$file_name, 0777) || !chmod(_PS_UPLOAD_DIR_.$file_name.'_small', 0777)) $this->errors[] = Tools::displayError('An error occurred during the image upload process.'); else $this->context->cart->addPictureToProduct($this->product->id, $indexes[$field_name], Product::CUSTOMIZE_FILE, $file_name); unlink($tmp_name); } return true; } Link to comment Share on other sites More sharing options...
gimmyp Posted January 13, 2015 Author Share Posted January 13, 2015 how i can solve this problem? Link to comment Share on other sites More sharing options...
gimmyp Posted January 15, 2015 Author Share Posted January 15, 2015 pleeeeease anyone can help me??? Link to comment Share on other sites More sharing options...
NemoPS Posted January 16, 2015 Share Posted January 16, 2015 After this $tmp_name = tempnam(_PS_TMP_IMG_DIR_, 'PS'); Try dumping the filename: var_dump($file_name); die(); Link to comment Share on other sites More sharing options...
gimmyp Posted January 19, 2015 Author Share Posted January 19, 2015 i obtain a blank page with this text:+ string(32) "7bc23f3f14b2ee038838a8c217f1f1a5" Link to comment Share on other sites More sharing options...
gimmyp Posted January 20, 2015 Author Share Posted January 20, 2015 Now how can i obtain the .jpg or .png after file name? Thanks in advance Link to comment Share on other sites More sharing options...
NemoPS Posted January 21, 2015 Share Posted January 21, 2015 Question: what is the file type of the image? png? jpg? gif? Try forcing it to something, like this: if (!ImageManager::resize($tmp_name, _PS_UPLOAD_DIR_.$file_name, null, null, 'jpg', true)) Link to comment Share on other sites More sharing options...
gimmyp Posted January 21, 2015 Author Share Posted January 21, 2015 (edited) nothing, doesn't work p.s: i've this problem with jpg, gif and png Edited January 21, 2015 by gimmyp (see edit history) Link to comment Share on other sites More sharing options...
gimmyp Posted February 10, 2015 Author Share Posted February 10, 2015 up Link to comment Share on other sites More sharing options...
VictorBah24 Posted February 19, 2015 Share Posted February 19, 2015 HI, So not understand, there is a solution for this error? Thanks in advance Link to comment Share on other sites More sharing options...
leaoxxi Posted February 26, 2015 Share Posted February 26, 2015 I´ve the same problema. Can anybody help? Link to comment Share on other sites More sharing options...
Yukinano Posted March 1, 2015 Share Posted March 1, 2015 Hello there. I'm having the same error in cloud too. When a new image is uploaded into the product category, it appears in blank. However, inside the product listing, the miniature is displaying correctly. But, on the shop itself it doesn't show. Link to comment Share on other sites More sharing options...
NemoPS Posted March 2, 2015 Share Posted March 2, 2015 It might not be regenerating the correct image type, did you try doing it manually? Link to comment Share on other sites More sharing options...
Yukinano Posted March 2, 2015 Share Posted March 2, 2015 It might not be regenerating the correct image type, did you try doing it manually? It's not regenerating the correct image type on the image. Doing manually... how? Link to comment Share on other sites More sharing options...
gimmyp Posted March 3, 2015 Author Share Posted March 3, 2015 I've the problem yet... It's possibile to solve it??? Link to comment Share on other sites More sharing options...
ktraving Posted March 9, 2015 Share Posted March 9, 2015 (edited) I am experiencing something similar. On all our products users have to attach an image file. They can choose and upload the file, but neither thumbnail nor filename appears in the cart once uploaded. Edit: Example screenshot. Edited March 9, 2015 by ktraving (see edit history) Link to comment Share on other sites More sharing options...
Aparsons Posted April 3, 2015 Share Posted April 3, 2015 I've got the same problem, however it can work as the site yourphotojigsaw.co.uk demonstrates (not my site). I think he had the same problem and noted it on the forum but I don't think he told us how he fixed it. This is important to me too as all my customers have to upload their photos. Am going to whinge to prestashop - it has to be a bug. Link to comment Share on other sites More sharing options...
NemoPS Posted April 4, 2015 Share Posted April 4, 2015 Oh, I'm sorry I totally missed answering this thread. I meant that you might try going to Preferences -> Images, select the image type that is not displaying, and regenerate (at the very bottom). Also, if you use a custom template, make sure it references the correct image type name Link to comment Share on other sites More sharing options...
Aparsons Posted April 4, 2015 Share Posted April 4, 2015 This has been listed as a bug back in January it is in the list of bugs and its reference is PSCX-4360 and its title is " Images uploaded in customization does not appear in cart"Please log in to the bug reporter and add your vote and comment. Then perhaps it will shoot up the list of priorities. If it has been listed since January and assigned to a programmer to sort out but nothing hs happened it looks as though it needs more weight behind it. I urge every member of the forum to vote for this one! To log in to the bug reporter: -www.prestashop.com -then at the very bottom of the page at the end of the last column under company click "contact us" -select "You found a bug on PrestaShop Cloud or PrestaShop download." -this brings you to the System Dashboard with CREATE highlighted in blue. -selecting this brings up a box "Create Issue" which has the line "Have you searched on this issue to avoid duplicates (click here)? - click here which brings up the search window. - search string "customisation image" brings up a short list of which our baby PSCX 4360 Images uploaded in customisation... is second. Select this. - Add your vote comment etc. I note now that Gregory says that the reporter has a 500 error while consulting the image and will look into that. However it is still a bug. Why has the poor sap got a 500 error on his image - all he has done is load up Prestashop to make his shop - should not have to delve into the mechanics of server php or whatever to have his customers send their images for T-shirts. - Lets get some weight behind this - the customisation implementation and the way it displays at bottom of the product page with the save button - is scruffy anyway. Thanks to all who have addressed this on the forums, Andrew Link to comment Share on other sites More sharing options...
Aparsons Posted April 4, 2015 Share Posted April 4, 2015 Hello Nemo, Have tried a number of things but with no avail. Have loaded up a fresh PrestaShop and added a 1 file customisation to a t-shirt. Obviously have done everything right, ie save button before add to basket button. The bug instantly manifested itself by showing an empty line for the uploaded file in the shopping cart summary. Have tested this on my embrionic sit some days ago and the file does come through to the back office. However this is useless if the customer experience is such that he has no confidence or confirmation that the file has uploaded has been accepted. Am just about to investigate the debug/errpr 500 possibility suggested on the bug report. Andrew Link to comment Share on other sites More sharing options...
Aparsons Posted April 11, 2015 Share Posted April 11, 2015 Hi Nemo, It's not a standard or product image problem, they all show up OK. It's when a customer uploads an image as part of the PrestaShop customisation facility for a product that the problem occurs. The image does not show up in the shopping cart summary as it should. I believe that the relevant code is in the shopping-cart-product-line.tpl template. This code points to the location of the uploaded file but the uploaded file does not display in the summary and if you down load it and try to display it it appears to be junk so it is probably encoded. To demonstrate the problem simply add a file customisation to a product in the BO. Then select the product in the FO and upload a file. Look at the shopping cart summary and you will see that there is no record of the image having been uploaded. If you are going to address this it would be nice to know how to retrieve the original filename of the uploaded file so that it can be displayed next to the image on the shopping cart summary. The file upload mechanism with its long coded filenames is far from clear - can anyone shed any light on it? Link to comment Share on other sites More sharing options...
gimmyp Posted April 13, 2015 Author Share Posted April 13, 2015 is possible that this bug is not solved yet? bah... Link to comment Share on other sites More sharing options...
NemoPS Posted April 13, 2015 Share Posted April 13, 2015 II tried reproducing it on both 1.6.0.9 and 1.6.0.14 and they seem to work on my local environment, so it might have to do with permissions really Link to comment Share on other sites More sharing options...
gimmyp Posted April 13, 2015 Author Share Posted April 13, 2015 i'm on is 7.5. What folder can i control for these files permissions??? Link to comment Share on other sites More sharing options...
NemoPS Posted April 13, 2015 Share Posted April 13, 2015 7.5...? You mean 1.5? Link to comment Share on other sites More sharing options...
Aparsons Posted April 13, 2015 Share Posted April 13, 2015 The files live in the upoad directory (called upload) but are assigned a coded key. In my remote server everything has 755 permissions and cannot see an obvious file permission difficulty - however would love to be proved wrong if it solves the problem. Anyone worked out the file upload story, it sees that the files in the upload directory are coded in some way and cannot be directly downloaded with ftp and viewed. Anyone worked out how this all works? I would like to put the file name on the invoice and the shopping cart summary. Where can I retrieve the file name - I have found the customisation code in the product-line.tpl file? Some people have got it to work - be good if they noted down how they solved it to we can try it. Link to comment Share on other sites More sharing options...
iqit-commerce Posted April 15, 2015 Share Posted April 15, 2015 Here is solution Edit file: /upload/.htaccess And remove line php_flag engine off 1 Link to comment Share on other sites More sharing options...
Aparsons Posted April 15, 2015 Share Posted April 15, 2015 Have finally solved it - with a lot of help from the chap who runs the warehouse prestashop them at iqit-commerce.com and the technical support at one.com. The answer is: in the .htaccess file that lives in the prestashop/upload directory there is a line at the end 'php_flag engine off' simply remove this line. Hope this helps - it has certainly helped me! Now what I would really like to do now is add the name of the image file under or along side the image. Anyone have any ideas? The file to tackle is the shopping-cart-product-line.tpl and the coded filename in upload is available but I cannot see how to get the original filename. 1 Link to comment Share on other sites More sharing options...
gimmyp Posted April 15, 2015 Author Share Posted April 15, 2015 (edited) For me this tweak don't solve nothing. Problem persists. 7.5...? You mean 1.5? IIS 7.5 on Win Server 2008 r2 PHP 5.5.8 Prestashop 1.6.0.14 Edited April 15, 2015 by gimmyp (see edit history) Link to comment Share on other sites More sharing options...
gimmyp Posted April 16, 2015 Author Share Posted April 16, 2015 I noticed that even the text of customization (custom text field) is not saved in the product page. Link to comment Share on other sites More sharing options...
NemoPS Posted April 17, 2015 Share Posted April 17, 2015 You might be having other issues then, not related to uploading files, I can't find any mention of it in the previous messages, are you using overrides? Default template? Link to comment Share on other sites More sharing options...
gimmyp Posted April 17, 2015 Author Share Posted April 17, 2015 I'm the problem with both customization fields (image and text). I use default template and i don't think that use overrides Link to comment Share on other sites More sharing options...
NemoPS Posted April 17, 2015 Share Posted April 17, 2015 Can you check if you do have any? Since customization fields don't get saved, it might be due to either a javascript or php issue behind the scenes Link to comment Share on other sites More sharing options...
gimmyp Posted April 17, 2015 Author Share Posted April 17, 2015 Yes i can but where i can check it? In the admin panel, modules section? Link to comment Share on other sites More sharing options...
NemoPS Posted April 17, 2015 Share Posted April 17, 2015 Oh for overrides? Access with ftp or file manager, see if you have anything inside override/controllers/front or override/classes Link to comment Share on other sites More sharing options...
gimmyp Posted April 17, 2015 Author Share Posted April 17, 2015 yes i have a lot of folders in override/classes and a file called CartController.php in override/controllers/front Link to comment Share on other sites More sharing options...
NemoPS Posted April 18, 2015 Share Posted April 18, 2015 Oh, it might be the cart controller then From the back office, performance, try disabling all overrides, temporarily, then test a new upload Link to comment Share on other sites More sharing options...
gimmyp Posted April 21, 2015 Author Share Posted April 21, 2015 don't work Link to comment Share on other sites More sharing options...
NemoPS Posted April 22, 2015 Share Posted April 22, 2015 what if you prefix it with an underscore to disable it, erase cache/class-Index.php and retry? Link to comment Share on other sites More sharing options...
gimmyp Posted April 22, 2015 Author Share Posted April 22, 2015 (edited) i've underscored the override/controllers/front/CartController.php and erased the cache/class_index.php... nothing Edited April 22, 2015 by gimmyp (see edit history) Link to comment Share on other sites More sharing options...
NemoPS Posted April 24, 2015 Share Posted April 24, 2015 I guess it's not that causing the issue then, I'm totally clueless. You should try to debug step by step, starting from the product controller where it waves the text (should be textRecord) and proceed from there Link to comment Share on other sites More sharing options...
gimmyp Posted May 11, 2015 Author Share Posted May 11, 2015 i need an expert help. can u send me in pvt the price for resolution of this issue? Link to comment Share on other sites More sharing options...
franklevel Posted October 28, 2015 Share Posted October 28, 2015 I am experiencing something similar. On all our products users have to attach an image file. They can choose and upload the file, but neither thumbnail nor filename appears in the cart once uploaded. Edit: Example screenshot. Here is solution Edit file: /upload/.htaccess And remove line php_flag engine off Link to comment Share on other sites More sharing options...
gimmyp Posted October 28, 2015 Author Share Posted October 28, 2015 Here is solution Edit file: /upload/.htaccess And remove line php_flag engine off form me doesn't work! Also the text doesn't appear after click the save button. Link to comment Share on other sites More sharing options...
demico Posted November 19, 2015 Share Posted November 19, 2015 it does not work here as well, i dont get a good minature , i can download it from the order page, so technical things work, but i would like to see the miniatures. Is there somebody who can help professionally? Link to comment Share on other sites More sharing options...
v84x4 Posted February 26, 2016 Share Posted February 26, 2016 Has this been fixed yet please? Link to comment Share on other sites More sharing options...
intandem Posted June 20, 2017 Share Posted June 20, 2017 (edited) Hi! I still have this same issue, ie. the upload of the customisation image file seems to work - it's in the uploads folder and I can download and see it fine via FTP. However, as part of the user experience during the pruchasing process, the thumbnail shows up as a broken image icon. If I right-click on it to Open in a New Tab, I get a message Forbidden You don't have permission to access /upload/f2cf544d8c2598888c7ec77c06f7e72f_small on this server. I tried changing file permissions even right up to 777 but this makes no difference. I don't have the "php_flag engine off" in the .htaccess file in the uploads folder. Does anybody have any other ideas? This is the .htaccessfile: deny from all <Files ~ "(?i)^.*\.(jpg|jpeg|gif|png|bmp|pdf)$"> order deny,allow allow from all </Files> If I am a customer trying to buy a product, I certainly would not proceed as it looks like my file was not uploaded. Any ideas? thanks! Edited June 20, 2017 by intandem (see edit history) Link to comment Share on other sites More sharing options...
TiaNex Shopping Posted September 17, 2017 Share Posted September 17, 2017 Hi! I still have this same issue, ie. the upload of the customisation image file seems to work - it's in the uploads folder and I can download and see it fine via FTP. However, as part of the user experience during the pruchasing process, the thumbnail shows up as a broken image icon. If I right-click on it to Open in a New Tab, I get a message Forbidden You don't have permission to access /upload/f2cf544d8c2598888c7ec77c06f7e72f_small on this server. I tried changing file permissions even right up to 777 but this makes no difference. I don't have the "php_flag engine off" in the .htaccess file in the uploads folder. Does anybody have any other ideas? This is the .htaccessfile: deny from all <Files ~ "(?i)^.*\.(jpg|jpeg|gif|png|bmp|pdf)$"> order deny,allow allow from all </Files> If I am a customer trying to buy a product, I certainly would not proceed as it looks like my file was not uploaded. Any ideas? thanks! hello,you may try to add the extension to the small image file elseif (!ImageManager::resize($tmp_name, _PS_UPLOAD_DIR_.$file_name.'_small.jpg', $product_picture_width, $product_picture_height)) $this->errors[] = Tools::displayError('An error occurred during the image upload process.'); elseif (!chmod(_PS_UPLOAD_DIR_.$file_name, 0777) || !chmod(_PS_UPLOAD_DIR_.$file_name.'_small.jpg', 0777)) $this->errors[] = Tools::displayError('An error occurred during the image upload process.'); else Link to comment Share on other sites More sharing options...
Recommended Posts