Author Topic: Problems with additional image fields and the upload form  (Read 4945 times)

0 Members and 1 Guest are viewing this topic.

Offline blue4603

  • Pre-Newbie
  • Posts: 7
    • View Profile
Problems with additional image fields and the upload form
« on: December 12, 2008, 06:16:58 AM »
Hello everyone,

I faced a weird problem.

I tried to add two additional fields to the image.

I followed the tutorial in the forums.

One of the fields is working fine while the other is not working. I will explain what I am doing on my site.

The two additional can be added using the upload form. When submitting the form, I am doing some modification to the fields in the member.php file before it is saved in the database. The first one can be modified and manipulated successfully. The second one, however,  always take what was posted in the form. I can not modify it. I tried to change its value before the sql query and but it reserves the posted value.

I tried to add a third additional field but the same problem.

So this is what I am facing. Could you help me plz.

Thanks

Regards

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Problems with additional image fields and the upload form
« Reply #1 on: December 12, 2008, 08:22:51 AM »
Show us what changes you do, we'll go from there ;)
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline blue4603

  • Pre-Newbie
  • Posts: 7
    • View Profile
Re: Problems with additional image fields and the upload form
« Reply #2 on: December 12, 2008, 06:23:31 PM »
Hi.

This is what I have changed

In db_field_definitions.php
I added
Code: [Select]
$additional_image_fields['image_personal'] = array("Personal Image", "text", 0);
$additional_image_fields['image_personal_colored'] = array("Personal Image color", "text", 0);

I added two columns to the 4images_images and 4images_images_temp

Code: [Select]
ALTER TABLE `4images_images` ADD `image_personal` text;
ALTER TABLE `4images_images` ADD `image_personal_colored` text;

ALTER TABLE `4images_images_temp` ADD `image_personal` text;
ALTER TABLE `4images_images_temp` ADD `image_personal_colored` text;

In the member_uploadform.html
I added

Code: [Select]

<textarea name="image_personal" cols="30" class="textarea" rows="10" wrap="VIRTUAL"></textarea>
<textarea type="hidden" name="image_personal_colored" cols="30" class="textarea" rows="10" wrap="VIRTUAL"></textarea>

In the member.php

I added this

Code: [Select]
  $image_personal = un_htmlspecialchars(trim($HTTP_POST_VARS['image_personal']));
  $image_personal_colored = un_htmlspecialchars(trim($HTTP_POST_VARS['image_personal_colored']));

$image_personal = modifystring($image_personal)
  $image_personal_colored = modifystring($image_personal_colored)

function modifystring($str)
{//put here arbitrary modification to the string
}

Now after uploading an image the image_personal is modified and stored. The image_personal_colored, however, will take only the posted value and can not be modified.
Even if I add this line before the sql query that saves the image
$image_personal_colored="blah blah";
the image_personal_colored value will not change. and will reserve the posted value.

I hope that I clarified my problem for you.

thanks for your help.

Regards
« Last Edit: December 13, 2008, 03:24:41 AM by blue4603 »

Offline alekinna

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
    • Gallery of cross-stitching
Re: Problems with additional image fields and the upload form
« Reply #3 on: December 12, 2008, 07:17:23 PM »
In the member.php

I added this

Code: [Select]
  $image_personal = un_htmlspecialchars(trim($HTTP_POST_VARS['image_personal']));
  $image_personal_colored = un_htmlspecialchars(trim($HTTP_POST_VARS['image_personal_colored']));

$image_personal = modifystring($image_personal)
  $image_personal_colored = modifystring($image_persona_colored)

function modifystring($str)
{//put here arbitrary modification to the string
}

maybe because misspell
$image_personal_colored = modifystring($image_personal_colored)

Offline blue4603

  • Pre-Newbie
  • Posts: 7
    • View Profile
Re: Problems with additional image fields and the upload form
« Reply #4 on: December 13, 2008, 03:25:19 AM »
Hi,

No I misspelled it in the post only.

Regards

Offline alekinna

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
    • Gallery of cross-stitching
Re: Problems with additional image fields and the upload form
« Reply #5 on: December 13, 2008, 04:04:09 AM »
Hi,

why you use type="hidden" for textarea  image_personal_colored?