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.

 

Link to comment
Share on other sites

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
}

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.