kamaltin Posted September 9, 2009 Share Posted September 9, 2009 Hi,I found that PS resize pictures which uploaded by customers. For examples it can be picture for T-shirt printing.I can't find reason why need resizing because printshops need original files w/o resizing or edition in term of quality printing.I am need even a sets of image files packed into zip or rar archive. It is conveniently for my customers.1) Can I disable fie resizing?2) How do I ad additional file extensions for customer uploadable files?3) Can I disable file preveiw in the admin/order details?thanks! Link to comment Share on other sites More sharing options...
stevel Posted September 9, 2009 Share Posted September 9, 2009 I saw this in the products.phptheir is a re-size originaland a re-size smallyou could add an option to check for isPicture($file['tmp_Name'])if that fails then you could copy ormove that file where ever u like.I'll post morein a sec i got a phone call Link to comment Share on other sites More sharing options...
stevel Posted September 9, 2009 Share Posted September 9, 2009 I finally got off the phone.Ok you want the option to add other files like zip files and rar or psdThe software uses a re-sizer to modify images that are uploaded.One is saved as a XXXXXX_small and the other is XXXXXXXXthe one with out the _small tag is of normal size (not re-sized, i believe)in the products.php file function uploadimage()There is a function that checks to see if the object is an image.This function is CheckImage()This function is located in the images-inc.phpThis is a overloaded functions so check your parameters to make sure your on the right one.The function first checks to see if the file is of the right sizeIt then checks to see if the file is an image using IsPicture()the IsPicture() is also located in the images-inc.phpIf you wish to add file types you can add them to the IsPicture functionIn that function you will find an array list with the valid file types.Once thing you have to look out for is make sure you don't try to re-size a psd fileit might work since it can re-size png files but they are saved without layers.Now if you wanted to add a zip file or other file extension you can create a new functionthat validates your other file types. So If a file fails its IsPicture but pass the IsOther. Then you can do what you like with the file.Basically in the products.php uploadimage() if check checkimage() = fail then checkother()if cehckother() = true then process the file just like the image but don't re-size it. You might have to do your own path combines so that you don't lose your file extension.I plan on doing this my self. When I get some free time I'll post what I have.Note you will also have to modify your back end so that you can download the file from a link and not try to display it. Link to comment Share on other sites More sharing options...
kamaltin Posted September 9, 2009 Author Share Posted September 9, 2009 I guess it is better to exclude both image resizing for preview as well as for file saving on site. I uploaded 1Mb file. When I downloaded it back from Back office it size was 700 Kb. Size of picture in pixel was same. PS compressed files. It is unacceptable, because for printing I need original files.Preview image is't need also. It is not informative. Just feature. Small image or .ico depend of file type or even one for all types file for link to saved file in Back office will be enough.I couldn't find where is file limitation of 1,3 Mb. will do later.I will try to make changes tomorrow. Unfortunately I am not so friendly with php coding. Link to comment Share on other sites More sharing options...
stevel Posted September 9, 2009 Share Posted September 9, 2009 I had some trouble with the file limitation myself.I was also unable to locate where the value was coming from.I just over wrote my value in the checkimage() functionThe first condition in that function checks to see if the file is larger than $MaxFileSizeI replaced the $MaxFileSize with 38000000 or something like that, this solved the file size issue.The checkimage() is located in the image-inc.php Link to comment Share on other sites More sharing options...
kamaltin Posted September 10, 2009 Author Share Posted September 10, 2009 Now customers can make upload of big files. What I did:1) changed php.ini upload_max_filesize = 20M post_max_size = 20M max_execution_time = 300 I guess it should be in .httaccess, however I work on local server.2) changed admin/tabs/AdminAttachments.php - increase limit of managed files. //from protected $maxFileSize = 2000000; //to protected $maxFileSize = 20000000; 3) changed product.php - added call for new function //from elseif (!imageResize($tmpName, _PS_PROD_PIC_DIR_.$fileName)) //to elseif (!imageNoResize($tmpName, _PS_PROD_PIC_DIR_.$fileName)) 4) added new function imageNoResize() to image.inc.php before imageResize() /** * No resize, no cut or no optimize image, just copy one image to another one. used for original image. * @return boolean Operation result */ function imageNoResize($sourceFile, $destFile, $destWidth = NULL, $destHeight = NULL, $fileType = 'jpg') { list($sourceWidth, $sourceHeight, $type, $attr) = getimagesize($sourceFile); if (!$sourceWidth) return false; $sourceImage = createSrcImage($type, $sourceFile); $destImage = $sourceImage; return (returnDestImage($fileType, $destImage, $destFile)); } 5) edited image.inc.php function returnDestImage() - improve picture quality. //from $flag = imagejpeg($ressource, $filename, 90); //to $flag = imagejpeg($ressource, $filename, 95); Finally. Customer can upload big images up to 20M and even admin can increase limit. But the problem with ZIP or other file types is still remining. Internet Printshop needs only unresized and unchaged files only - because of quality issue. We print files up to 1Gb. However PHP functions used for image upload make resizing and optimizations. Quality and eligibility of uploaded images can check only print-worker, not admin or operator of Prestashop. So image preview is not need. Admin is needed link for file download or deleting.Task list:1) BO: Admin manage list of allowed files for upload (e.g. jpg, tif, zip, rar).2) BO: Admin manage max file size.3) FO: Customer upload allowed files only.3.a) PS copy files from customer computer to server w/o changes or treatment.3. PS create link for cart, BO/vieworder, FO/blockmyaccount/history.I am not a php-programmer and it is not a trivial task for me. But I will try. If anyone can help - you are welcome. Link to comment Share on other sites More sharing options...
stevel Posted September 10, 2009 Share Posted September 10, 2009 That's great.Thank you very much for the detailed information.I my self don't program in php either, slowly learning it. Link to comment Share on other sites More sharing options...
JAKCRABBIT Posted December 17, 2009 Share Posted December 17, 2009 THX, GREAT!!! Link to comment Share on other sites More sharing options...
Rolo Tomasi Posted March 4, 2010 Share Posted March 4, 2010 I found this really helpful and it worked a treat - thanksMy only issue was that I do not have access to the php.ini file and my website host would only allow uploads of 2MB. I got round this by creating the .htaccess file outlined in this post and placing the file in my root directory. Link to comment Share on other sites More sharing options...
Numpaque Posted April 29, 2010 Share Posted April 29, 2010 Now customers can make upload of big files. What I did:1) changed php.iniupload_max_filesize = 20M post_max_size = 20M max_execution_time = 300 I guess it should be in .httaccess, however I work on local server.2) changed admin/tabs/AdminAttachments.php - increase limit of managed files. //from protected $maxFileSize = 2000000; //to protected $maxFileSize = 20000000; 3) changed product.php - added call for new function //from elseif (!imageResize($tmpName, _PS_PROD_PIC_DIR_.$fileName)) //to elseif (!imageNoResize($tmpName, _PS_PROD_PIC_DIR_.$fileName)) 4) added new function imageNoResize() to image.inc.php before imageResize() /** * No resize, no cut or no optimize image, just copy one image to another one. used for original image. * @return boolean Operation result */ function imageNoResize($sourceFile, $destFile, $destWidth = NULL, $destHeight = NULL, $fileType = 'jpg') { list($sourceWidth, $sourceHeight, $type, $attr) = getimagesize($sourceFile); if (!$sourceWidth) return false; $sourceImage = createSrcImage($type, $sourceFile); $destImage = $sourceImage; return (returnDestImage($fileType, $destImage, $destFile)); } 5) edited image.inc.php function returnDestImage() - improve picture quality. //from $flag = imagejpeg($ressource, $filename, 90); //to $flag = imagejpeg($ressource, $filename, 95); Finally. Customer can upload big images up to 20M and even admin can increase limit. But the problem with ZIP or other file types is still remining. Internet Printshop needs only unresized and unchaged files only - because of quality issue. We print files up to 1Gb. However PHP functions used for image upload make resizing and optimizations. Quality and eligibility of uploaded images can check only print-worker, not admin or operator of Prestashop. So image preview is not need. Admin is needed link for file download or deleting.Task list:1) BO: Admin manage list of allowed files for upload (e.g. jpg, tif, zip, rar).2) BO: Admin manage max file size.3) FO: Customer upload allowed files only.3.a) PS copy files from customer computer to server w/o changes or treatment.3. PS create link for cart, BO/vieworder, FO/blockmyaccount/history.I am not a php-programmer and it is not a trivial task for me. But I will try. If anyone can help - you are welcome. Hi, I followed all the steps but no work!! all the images are compressed my shop is www.sttikup.comhttp://www.sttikup.com/artistas/11-wild-sea.htmlI hope you can help me about it I don't Know what can i do!thanks in advance Link to comment Share on other sites More sharing options...
Ivancsg Posted July 6, 2010 Share Posted July 6, 2010 I can't find the php.ini file Link to comment Share on other sites More sharing options...
kamaltin Posted July 6, 2010 Author Share Posted July 6, 2010 I can't find the php.ini file if you work online it is on hosters server side.try to put into .htaccess folowing:# Max size upload filephp_value upload_max_filesize 100Mphp_value post_max_size 100Mphp_value max_execution_time 300php_value max_input_time 300probably it will help. Link to comment Share on other sites More sharing options...
Ivancsg Posted July 6, 2010 Share Posted July 6, 2010 there doesn't seem to be any thing in my htaccess file....should there be?when I do what you suggest I get the following Error500 - Internal Server ErrorThis is a temporary server error.Please try to reload the webpage later.If you are the webmaster of this site please log in to Cpanel and check the Error Logs. You will find the exact reason for this error there.Common reasons for this error are:Incorrect file/directory permissions: Above 755. In order files to be processed by the webserver, their permissions have to be equal or below 755. You can update file permissions with a FTP client or through cPanel's File Manager. Incorrect Apache directives inside .htaccess file. Make sure you have not specified unsupported directives inside the local .htaccess file. Such include PHP settings and Apache module settings. Link to comment Share on other sites More sharing options...
dewaz Posted August 15, 2010 Share Posted August 15, 2010 cant find setting to enable file uploads. May I ask how to activate customization page and enable file upload? Link to comment Share on other sites More sharing options...
TassaDarK Posted September 3, 2010 Share Posted September 3, 2010 It's on each item individual page, there is a "customization" tab where you can choose how many files uploads and text fields for customization will appear in that product. Link to comment Share on other sites More sharing options...
Ordog Posted October 4, 2010 Share Posted October 4, 2010 Works great thanks, anyone who it isnt working for needs to follow the instructions exactly Link to comment Share on other sites More sharing options...
TassaDarK Posted October 4, 2010 Share Posted October 4, 2010 Ordog what version of PS do you have? This doesn't work in 1.3.1 as far i know Link to comment Share on other sites More sharing options...
Ordog Posted October 4, 2010 Share Posted October 4, 2010 I had it working on 1.3.1 and updated to 1.3.2 today and its working on there also Link to comment Share on other sites More sharing options...
ChrisU2R Posted January 20, 2011 Share Posted January 20, 2011 Tried the modification but only marginally improved file quality - Uploaded 9mb file, PS out of the box resized/optimised to 2.68mb and having edited the files as suggested I was getting 3.95mbHelpful, but not quite there. Link to comment Share on other sites More sharing options...
Recommended Posts