Forums

image resize cant work

seppo 23 May, 2016
Hi,

I have a file upload action, that successfully uploads a file - and at the same time adds timecode to front of filename as a default (cannot turn this off unless I edit the original file_upload.php file..)

Then, after the upload (or preferably during) I would like to resize the uploaded image, so I added Image resize -action (to uploads on success-event). So far it has failed.
There, in the General Settings is first field: Image field name. While I can put there the upload file -field, it will the name of the file will be modified after that by the file upload actions "File name code" -field (which, cannot be disabled or changed). Won't this cause it always to fail?

Then, in the Big/Medium/Small -image-tabs there is Directory field. Is there an option for it to use same directory as default, where the file is located at? Even if it did use that as default, how can I set what is the original directory?
I believe I could use custom code to add the directory and image file name dynamically (like I can use it to set username to directory name) to "Image field name" on General Settings tab, and similar method to Medium image tab's Directory, but first of all, it didn't work when I tried, and secondly, I cannot set the image name correctly since it is modified on the fly by the default PHP code adding current time stamp to it, by the upload file -action.

So, how can I resize the uploaded image file with CF5?
GreyHead 24 May, 2016
Hi seppo,

ChronoForms should recognise the new name for the file from the data in the $form->data array - you can see this by adding a debugger. The debugger output will also show you the folder where the image is being saved.

The directory where the file will be stored should be an absolute path to a server folder. The default value is . your_server_root_path\components\com_chronoforms5\uploads\form_name\

Bob
seppo 24 May, 2016
Hi GreyHead,

I do not know what was the problem the first time I used the file upload fields name for the image resize tabs Image field name, but when I tried it again, it was taking it OK. So now it works fine.

Thanks for help!
This topic is locked and no more replies can be posted.