On sumit the user of my form is able to upload an image to a specified directory. This works just fine. I would like to include some extra php code under the extra code field under the Form code tab. My question is, how do I get this code to kick? It says on this tab "Info:This code will run if task=extra is provided in the form URL". I am unclear what I must do? My second query must only run once the php code within my onsubmit button has completed. In my case I only want the extra code block to run once I am absolutely ceratin that a potentially large image file has been uploaded onto the server. Thanks in advance for any help here.
Forums
Getting extra code block to run?
Hi Ugly,
I don't think that the form will submit until the upload is complete so you may not need this process at all.
Otherwise you will need to detect the upload completion (I've no idea how you do that) and then call a url like
Bob
I don't think that the form will submit until the upload is complete so you may not need this process at all.
Otherwise you will need to detect the upload completion (I've no idea how you do that) and then call a url like
http://mydomain/index.php?option=com_chronocontact&chronoformname=some_name&task=extra
Bob
Thanks for your reply Bob. My end objective is that once a user has uploaded an image to the server the image is manipulated thougth PHP code (using GD graphics library functions). So a typical scenario would involve the user uploading an image which is too large or has the wrong aspect ratio for display - let's say. Immediately that image is received on my server I want to look at it and manipulate it using PHP to make it suitable for presentation within an article. I have the code ready for this but I am unsure where to put it? I thought the extra code box would be the place to place it? Apart from this I am still unsure how to invoke this extra code, I can see you are including the call within the form URL but how do I call/generate this? The form URL is automatically generated so how do I append '&task=extra' to the URL? Thanks for any further advice.
Hi Ugly,
Try the Resize Image plugin - that will re-size images on upload. Seems to work fine for me on images up to a few Mb. It has options to create three different sizes.
Bob
Try the Resize Image plugin - that will re-size images on upload. Seems to work fine for me on images up to a few Mb. It has options to create three different sizes.
Bob
thanks for the pointer Bob, where can I download this component? I can't locate it.
Hi ugly,
Assuming you have a recent CF release then you should already have it. Check the Plugins column at the left of the Forms Manager for "Image resize & thumbnail".
To use it click the checkbox by a form name and then the plug-in link.
One version had a problem with filename suffixes being wrongly applied - if you have that ask me and I'll post the updated version here.
Bob
Assuming you have a recent CF release then you should already have it. Check the Plugins column at the left of the Forms Manager for "Image resize & thumbnail".
To use it click the checkbox by a form name and then the plug-in link.
One version had a problem with filename suffixes being wrongly applied - if you have that ask me and I'll post the updated version here.
Bob
Thanks Bob,
Fits the bill!! Does it reduce the file size for large images do you know?
Fits the bill!! Does it reduce the file size for large images do you know?
Hi ugly,
Yes it does, it uses GD as you were planning to. It has crop and re-size options and can produce three different re-sizes images e.g. thumbnail, preview and full-size. It will keep or delete the original.
If I recall correctly the re-size is fairly intelligent about handling portrait & landscape images.
Bob
Yes it does, it uses GD as you were planning to. It has crop and re-size options and can produce three different re-sizes images e.g. thumbnail, preview and full-size. It will keep or delete the original.
If I recall correctly the re-size is fairly intelligent about handling portrait & landscape images.
Bob
This topic is locked and no more replies can be posted.