Hi all,
I am having a problem with image resizing. my images upload correctly though the image resizing action doesn't do anything to the file.
Debug info suggests it has done the resize but all my images are still large files and i need them to be crunched to save space.
Debug info:
Any suggestions would be welcome.
Kind Regards
Allan
I am having a problem with image resizing. my images upload correctly though the image resizing action doesn't do anything to the file.
Debug info suggests it has done the resize but all my images are still large files and i need them to be crunched to save space.
Debug info:
Upload files
File post array: Array ( [name] => [type] => [tmp_name] => [error] => 4 [size] => 0 )
No file has been selected
File post array: Array ( [name] => IMG_0813.JPG [type] => image/jpeg [tmp_name] => /tmp/phpopAlWg [error] => 0 [size] => 2682988 )
Upload routine started for file upload by: adi_image_1
Success: 20150512164616_img_0813.JPG has been uploaded OK.
File size is 2,620 kb
File path is:
/var/www/html/images/Vehicles/Temp/allanbeth1/20150512164616_img_0813.JPG
File url is:
http://www.hellomyauto.com/images/Vehicles/Temp/allanbeth1/20150512164616_img_0813.JPG
File post array: Array ( [name] => [type] => [tmp_name] => [error] => 4 [size] => 0 )
No file has been selected
File post array: Array ( [name] => [type] => [tmp_name] => [error] => 4 [size] => 0 )
No file has been selected
File post array: Array ( [name] => [type] => [tmp_name] => [error] => 4 [size] => 0 )
No file has been selected
File post array: Array ( [name] => [type] => [tmp_name] => [error] => 4 [size] => 0 )
No file has been selected
File post array: Array ( [name] => [type] => [tmp_name] => [error] => 4 [size] => 0 )
No file has been selected
File post array: Array ( [name] => [type] => [tmp_name] => [error] => 4 [size] => 0 )
No file has been selected
File post array: Array ( [name] => [type] => [tmp_name] => [error] => 4 [size] => 0 )
No file has been selected
File post array: Array ( [name] => [type] => [tmp_name] => [error] => 4 [size] => 0 )
No file has been selected
Image_Resize
54
thumb_big
20150512164616_img_0813.JPG
thumb_med
thumb_smallas you can see, i am uploading one file and that is working correctly, once the file is uploaded, it is moved from a temp location to a specified location coded with php, this works fine. the middle step is the problem. the image wont rezise.
Any suggestions would be welcome.
Kind Regards
Allan
Hi Allan,
Do you know what is causing all the [error] => 4 lines?
It looks as though a big thumb is being created? How do you have the set up for the Image Resizer?
Bob
Do you know what is causing all the [error] => 4 lines?
It looks as though a big thumb is being created? How do you have the set up for the Image Resizer?
Bob
Hi Bob,
I have 10 file uploads, the errors are just the upload elements that don't have any files attached, in the case above i only uploaded a file using the second file upload elements so those errors are expected. The element named adi_image_1 is what i was using to test the form. (saves time to only test one of the uploads rather than them all). Just for clarification all the uploads are working as expected, once the file is uploaded to the server, there are file resizers for each of the corresponding elements. As you can see the file resize returns positive in the debug, but it doesn't actually perform the resize.
Hope that makes sense
Kind Regards
Allan
I have 10 file uploads, the errors are just the upload elements that don't have any files attached, in the case above i only uploaded a file using the second file upload elements so those errors are expected. The element named adi_image_1 is what i was using to test the form. (saves time to only test one of the uploads rather than them all). Just for clarification all the uploads are working as expected, once the file is uploaded to the server, there are file resizers for each of the corresponding elements. As you can see the file resize returns positive in the debug, but it doesn't actually perform the resize.
Hope that makes sense
Kind Regards
Allan
Oopps, forgot to answer your second question.
Settings on the General tab are:
Delete Original: no
Image field name: adi_image_1
Output image(s) quality:90
Big image directory: left blank so its the same as the file upload location NB even if i change this nothing happens.
No Prefix or Suffix
Image Height:300
Image Width 400
The goal is to over write the original file with the resized on.
I stupidly forgot to mention that i have recently changed servers and the resize was working correctly on the old server.
Thanks
Allan
Settings on the General tab are:
Delete Original: no
Image field name: adi_image_1
Output image(s) quality:90
Big image directory: left blank so its the same as the file upload location NB even if i change this nothing happens.
No Prefix or Suffix
Image Height:300
Image Width 400
The goal is to over write the original file with the resized on.
I stupidly forgot to mention that i have recently changed servers and the resize was working correctly on the old server.
Thanks
Allan
Hi Allan,
It sounds as though the GD library that the resizer uses may not be installed in the new server's PHP.ini file? Can you check on the site PHP Info page.
Bob
It sounds as though the GD library that the resizer uses may not be installed in the new server's PHP.ini file? Can you check on the site PHP Info page.
Bob
gd
GD Support enabled
GD Version 2.1.1-dev
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.5.2
GIF Read Support enabled
GIF Create Support enabled
JPEG Support enabled
libJPEG Version 8
PNG Support enabled
libPNG Version 1.2.50
WBMP Support enabled
XPM Support enabled
libXpm Version 30411
XBM Support enabled
WebP Support enabled
This is what i get from the php infomation page in the backend
All seems enabled, yet it won't resize
Kind Regards
Allan
GD Support enabled
GD Version 2.1.1-dev
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.5.2
GIF Read Support enabled
GIF Create Support enabled
JPEG Support enabled
libJPEG Version 8
PNG Support enabled
libPNG Version 1.2.50
WBMP Support enabled
XPM Support enabled
libXpm Version 30411
XBM Support enabled
WebP Support enabled
This is what i get from the php infomation page in the backend
All seems enabled, yet it won't resize
Kind Regards
Allan
Hi Allan,
That all looks good, another theory bites the dust. Please take a Form Backup using the icon in the Forms Manager and post it here or email it to me and I'll take a closer look.
Bob
That all looks good, another theory bites the dust. Please take a Form Backup using the icon in the Forms Manager and post it here or email it to me and I'll take a closer look.
Bob
Hi Allan,
Thanks for the backup, I ran a test and the resizer appears to be working OK - at least on the first file input. It has the same name as the uploaded file which is a bit confusing but has definitely been resized.
I tested on Joomla! 3 with PHP 5.4
I did have to disable or remove all the DB Saves as I didn't have a matching db table but I doubt that is causing your problem.
I'd suggest that the next step is to test with a minimal form - just one file upload and no extra code or actions and see if that works.
Bob
Thanks for the backup, I ran a test and the resizer appears to be working OK - at least on the first file input. It has the same name as the uploaded file which is a bit confusing but has definitely been resized.
I tested on Joomla! 3 with PHP 5.4
I did have to disable or remove all the DB Saves as I didn't have a matching db table but I doubt that is causing your problem.
I'd suggest that the next step is to test with a minimal form - just one file upload and no extra code or actions and see if that works.
Bob
Thanks bob,
i will do as you suggest and see what happens.
Thanks again
Allan
i will do as you suggest and see what happens.
Thanks again
Allan
Hi Bob,
I have tested a simple upload form and it kind of works.
If I put a path in the Big image directory field then it works fine, however if i leave it blank then it doesn't work.
My problem is that i need to leave it blank and use the path from the file upload action as i am using your upload action as i am using {username} in the upload path.
It's like the resize action isn't able to use the path from the file upload action.
Any ideas?
Kind Regards
Allan
I have tested a simple upload form and it kind of works.
If I put a path in the Big image directory field then it works fine, however if i leave it blank then it doesn't work.
My problem is that i need to leave it blank and use the path from the file upload action as i am using your upload action as i am using {username} in the upload path.
It's like the resize action isn't able to use the path from the file upload action.
Any ideas?
Kind Regards
Allan
Hi Allan,
Ah, OK, that explains what is happening.
I don't' think that there is any option to use a dynamic path directly with the Image Re-sizer. What you can do is a bit tedious but should work - upload and resize all of the images into a common folder, then, after the ReSize use a Custom Code action to move them to the dynamic 'username' folder. The core code would be something like this
Bob
PS Just noticed that this uses $form->files and that is CFv5 syntax - different names used in CFv4 :-(
Ah, OK, that explains what is happening.
I don't' think that there is any option to use a dynamic path directly with the Image Re-sizer. What you can do is a bit tedious but should work - upload and resize all of the images into a common folder, then, after the ReSize use a Custom Code action to move them to the dynamic 'username' folder. The core code would be something like this
<?php
jimport('joomla.filesystem.file'); // this may be different in J3??
foreach ( $form->files as $k => $f ) {
if (JFile::exists($f['link']) ) {
$path = str_replace('xxx', $form->data['user_name'], $f['link']);
$url = str_replace('xxx', $form->data['user_name'], $f['url']);
JFile::move($f['link'], $path);
$form->files[$k]['link'] = $path;
$form->files[$k]['url'] = $url;
}
}
?>!! not tested and will need debugging !!
Bob
PS Just noticed that this uses $form->files and that is CFv5 syntax - different names used in CFv4 :-(
Thanks for this bob, It might be an option if all else fails.
The thing i cant work out is that the image resizer worked fine on my previous server set up as it is now.
I presume the file upload adds a php variable to the form with the upload path which the image resizer uses as the path to save the resized image to? what could be stopping the resizer to get this path and could i add this to the form manually through a custom code. do you know what the path variable is called that the resizer uses?
Kind Regards
Allan
The thing i cant work out is that the image resizer worked fine on my previous server set up as it is now.
I presume the file upload adds a php variable to the form with the upload path which the image resizer uses as the path to save the resized image to? what could be stopping the resizer to get this path and could i add this to the form manually through a custom code. do you know what the path variable is called that the resizer uses?
Kind Regards
Allan
Hi Allan,
I had a poke around the code and it looks to me as if the Resizer gets the file location from the $form->files array and then saves either to the folder specified in the Resizer action; or to the default uploads/form_name folder.
Bob
I had a poke around the code and it looks to me as if the Resizer gets the file location from the $form->files array and then saves either to the folder specified in the Resizer action; or to the default uploads/form_name folder.
Bob
Hi Bob
If this is the case, and i leave the Big image directory empty in the resize action, then it should be saving the resized image to the forms upload folder; which it doesn't.
Is there a way i can code after the upload action and before the resize action to set the big image directory?
Kind Regards
Allan
If this is the case, and i leave the Big image directory empty in the resize action, then it should be saving the resized image to the forms upload folder; which it doesn't.
Is there a way i can code after the upload action and before the resize action to set the big image directory?
Kind Regards
Allan
I cant help but think it's to do with the change of server. The resize worked fine on the previous server when i left the Big Directory Path empty. The files would upload, then be overwritten with the resized image. the fact that the resizer doesnt do anything unless the Big Image Directory has a path is surely not the way it should work.
Sorry to be a pest about this, it's just the last thing i need to get fixed, everything else on the site works as expected.
Kind Regards,
Allan
Sorry to be a pest about this, it's just the last thing i need to get fixed, everything else on the site works as expected.
Kind Regards,
Allan
Hi allanbeth,
I'm out of ideas here, I can only suggest that you use debug code to see what is happening step by step to pin down the point where the error occurs?
Bob
PS Is it possible that there is a missing read/write permission on the new server?
I'm out of ideas here, I can only suggest that you use debug code to see what is happening step by step to pin down the point where the error occurs?
Bob
PS Is it possible that there is a missing read/write permission on the new server?
Hi Bob,
Thanks for all your help!
All the permissions on the server are set correctly.
I think i will just change the way the files are uploaded. upload all images to a fixed temporary folder, that way i can set the image resizers using a path in the Big image directory. (this i know works) Thankfully i am using your excellent file upload action which will allow me to set file names using {datetime}_{random} which will ensure no duplicates in the folder.
Again, thanks for all your efforts, as always, very much appreciated.
Kind Regards,
Allan
Thanks for all your help!
All the permissions on the server are set correctly.
I think i will just change the way the files are uploaded. upload all images to a fixed temporary folder, that way i can set the image resizers using a path in the Big image directory. (this i know works) Thankfully i am using your excellent file upload action which will allow me to set file names using {datetime}_{random} which will ensure no duplicates in the folder.
Again, thanks for all your efforts, as always, very much appreciated.
Kind Regards,
Allan
This topic is locked and no more replies can be posted.
