stevel Posted September 8, 2009 Share Posted September 8, 2009 First off this is the issue.I need my clients to upload a image when they buy a product.This image will be then printed at 32"x44" so i need a high resolution image.So don't tell me i don't need a BIG IMAGE!The issue I'm having is that when i try to upload a large image from the client sideI get the error (image is too large (xxxxKB). Maximum allowed: 131.072KB)My php settings are set for a maximum of 38MB upload and post size.I have already modified the $MaxFileSize in theadmin\tabs\adminatachments.php to allow me to upload large images from the backoffice.Now I just need to find what php file contains the settings for the client side upload.and yes I have used the search button blaw blaw blaw keep on flaming your not helping...Thank you, Link to comment Share on other sites More sharing options...
stevel Posted September 8, 2009 Author Share Posted September 8, 2009 I managed to get this working... somewhat.Under images.inc.php function checkImage($file, $maxFileSize) { if ($file['size'] > 32000000)//$maxFileSize) return Tools::displayError('image is too large').' ('.($file['size'] / 1000).Tools::displayError('KB').'). '.Tools::displayError('Maximum allowed:').' '.($maxFileSize / 1000).Tools::displayError('KB'); if (!isPicture($file)) return Tools::displayError('image format not recognized, allowed formats are: .gif, .jpg, .png'); if ($file['error']) return Tools::displayError('error while uploading image; change your server\'s settings'); return false; } I commented out the $maxFileSize and replaced it with my own, and it seemed to work.Now the error I'm receiving isWarning: exec() [function.exec]: Unable to fork [file -b --mime-type "C:\Inetpub\temp\php3FC.tmp"]I'm sure this is a php/windows permission error I'll figure it out and post more. Link to comment Share on other sites More sharing options...
stevel Posted September 8, 2009 Author Share Posted September 8, 2009 The error seems be caused because php does not have permission to execute/modify that file.Now the bigger issue is the file just isn't there. So I must be loosening it somewhere else.I'll keep on digging. Link to comment Share on other sites More sharing options...
rapidtime Posted September 8, 2009 Share Posted September 8, 2009 try this: open .htaccess and add the following ## adjust memory limit php_value memory_limit 64M php_value max_execution_time 18000 Link to comment Share on other sites More sharing options...
stevel Posted September 9, 2009 Author Share Posted September 9, 2009 I think i got everything working.But I have one question.After uploading an image I get an errorWarning: exec() [function.exec]: Unable to fork [file -b —mime-type “C:\Inetpub\temp\php3FC.tmp”]What does the following code do? This code is located under images.inc.php line 89Everything else works till this point. $mime_type = trim(exec('file -b --mime-type '.escapeshellarg($file['tmp_name']))); Additionallywhen a file attachment is uploaded by a client how is it attached to the product they purchased.So far I see no reference, do I have have add that myself? Link to comment Share on other sites More sharing options...
stevel Posted September 9, 2009 Author Share Posted September 9, 2009 thank you RapidTime,But I think i figured out what it was.It seems that the image was being uploaded to the \uploads\and it was given a md5 file name.The file is then re-sized and placed somewhere else.But the $file['tmp_name'] was looking for the file in the \img\tmp\ directoryso I added some code at the bottom of the function that copied the files to the expected location copy(_PS_PROD_PIC_DIR_.$fileName,$file['tmp_name']); chmod($file['tmp_name'], 0755); But now there are some permission errors as posted above.I've added the chmod to edit the permissions.This still caused an issue so I commented out the line since I can't tell what the hell that line is doing anyways.I guess my next challenge is to associate the uploaded file with the current product and then add it to the cart. Link to comment Share on other sites More sharing options...
stevel Posted September 9, 2009 Author Share Posted September 9, 2009 I know what its looking for now.I just need to find a way of doing it with php 5.2.10 Link to comment Share on other sites More sharing options...
stevel Posted September 9, 2009 Author Share Posted September 9, 2009 well i guess my stuff was just wrong to begin with.I changed the line to the following and it worked$mime_type = trim(@exec('file -bi '.escapeshellarg($file['tmp_name']))); Link to comment Share on other sites More sharing options...
kamaltin Posted September 9, 2009 Share Posted September 9, 2009 Hi Stevel,you are my brother of disaster! I got same problem today and posted another one topic here:http://www.prestashop.com/forums/viewthread/27570/general_discussion/ps_resize_all_images_uploaded_by_customers_dot__how_do_i_deactivate_itIf anyone will help I will inform you! Link to comment Share on other sites More sharing options...
a_sun Posted January 18, 2010 Share Posted January 18, 2010 well i guess my stuff was just wrong to begin with.I changed the line to the following and it worked$mime_type = trim(@exec('file -bi '.escapeshellarg($file['tmp_name']))); I changed as same with you mentioned. hit error msg :Parse error: parse error, unexpected T_STRING in E:\wwwusr\vhosts\easternprinters.com\httpdocs\store\images.inc.php on line 80Any idea? Link to comment Share on other sites More sharing options...
stevel Posted January 18, 2010 Author Share Posted January 18, 2010 Greetings a_sun.It's been a while since I worked on this code. I can't really remember what I did to get everything working.But I do know that it now works on my site.I'll post my images.inc.php file perhaps you might find what you need from it.I'll try and go over it again and see if I can recall what I changed.http://www.customscrolls.com/images.inc.php.txt Link to comment Share on other sites More sharing options...
stevel Posted January 18, 2010 Author Share Posted January 18, 2010 It's starting to come back to me.I remember the issue being with function isPicturedepending on the version of php their are several different commandsto get the file type.You'll have to do a search on the web for your php versionand find a method of returning back the file type ($mime_type)The function already contains a few methods but they might have changedif your php version is newer.You can see what I use in my previous post. Link to comment Share on other sites More sharing options...
a_sun Posted January 19, 2010 Share Posted January 19, 2010 Greetings a_sun.It's been a while since I worked on this code. I can't really remember what I did to get everything working.But I do know that it now works on my site.I'll post my images.inc.php file perhaps you might find what you need from it.I'll try and go over it again and see if I can recall what I changed.http://www.customscrolls.com/images.inc.php.txt Hi stevel:After replace with your images.inc.php, I hit another error...Warning: unlink(E:\wwwusr\vhosts\easternprinters.com\httpdocs\store/upload/921cb63704e35d288742e2e70a069517) [function.unlink]: Permission denied in E:\wwwusr\vhosts\easternprinters.com\httpdocs\store\classes\Cart.php on line 972Warning: unlink(E:\wwwusr\vhosts\easternprinters.com\httpdocs\store/upload/921cb63704e35d288742e2e70a069517_small) [function.unlink]: Permission denied in E:\wwwusr\vhosts\easternprinters.com\httpdocs\store\classes\Cart.php on line 973I have checked my ttpdocs\store/upload & Cart.php Permission been set to "Read & Write"Any idea?Many Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts