Jump to content

Need help putting seperate arrays from a form together


tryingtolearn

Recommended Posts

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.

 

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
}

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.