tryingtolearn Posted March 9, 2008 Share Posted March 9, 2008 I have a form with three fields that are passing 1. The x coordinate of the image 2. The y coordinate of the image 3. An image name (It can be any # of images depending on how many were selected) <input type="hidden" name="x[]" id="x'.$key.'" /> <input type="hidden" name="y[]" id="y'.$key.'" /> <input type="hidden" name="v[]" value="'.$value.'" /> on the process page I can get all the info I need by doing a foreach for each of the fields But I need to somehow get all the information to be able to create the following for each image selected imageCopyMerge($png, THE VALUE FIELD HERE, THE X VALUE HERE, THE Y VALUE HERE, 0, 0, $w1, $h1, 100); How can I get all the info together to write the imageCopyMerge for each ? I hope that makes sense. Quote Link to comment https://forums.phpfreaks.com/topic/95209-need-help-putting-seperate-arrays-from-a-form-together/ Share on other sites More sharing options...
Barand Posted March 9, 2008 Share Posted March 9, 2008 Before the answer you are looking for, a couple of observations 1 ) x and y fields have no values. 2 ) imageCopyMerge() requires the second arg to be a gd image resource, not a filename so first you need something like $src = imagecreatefromjpeg(THE VALUE FIELD HERE) and use $src as the second arg. Processing the form data <?php foreach ($_POST['v'] as $k = $v) { $x = $_POST['x'][$k]; $y = $_POST['y'][$k]; // process $v, $x, $y } Quote Link to comment https://forums.phpfreaks.com/topic/95209-need-help-putting-seperate-arrays-from-a-form-together/#findComment-487671 Share on other sites More sharing options...
tryingtolearn Posted March 9, 2008 Author Share Posted March 9, 2008 The x and y values are populated from a javascript I am getting those values passed I have all the info for the other ImageCopyMerge converted - just had a hard time getting it done for each image I will try the foreach and let you know. Barand - You are AWESOME on this board!-Always helping me. Quote Link to comment https://forums.phpfreaks.com/topic/95209-need-help-putting-seperate-arrays-from-a-form-together/#findComment-487682 Share on other sites More sharing options...
tryingtolearn Posted March 9, 2008 Author Share Posted March 9, 2008 Worked PERFECT Thanks again! Quote Link to comment https://forums.phpfreaks.com/topic/95209-need-help-putting-seperate-arrays-from-a-form-together/#findComment-487688 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.