Pankti Bhalani
Pankti Bhalani

Reputation: 1

giving contrast effect to images using php

here is my html/php code:

<form method="post" action="contrast.php">
  <li><input type="image" height="200" width="200" src="show_image.php?id='2'"   
  id="image" onclick="document.getElementById('hidimgSrc').value                   
  =this.src;document.getElementById('myform').submit();" name="abc"></li> 
  </form>

here is the php code for contrast.php the image:

 <?php
    $a=(string)$_POST['abc'];
    echo $a;
    $image = imagecreatefromjpeg($a); 
    imagefilter($image, IMG_FILTER_CONTRAST, -80); 
    imagejpeg($image, 'contrast-sun.jpg'); 
    imagedestroy($image); 
    echo '<img src="contrast-sun.jpg" alt="Image With A Contrast Effect Applied" />'; 

   ?>

here the error coming is Undefined index: abc in C:\wamp\www\radha\contrast.php on line 2 that is the name of the image is not being submit properly .....so anybody plzz help me with this ?

Upvotes: 0

Views: 616

Answers (1)

Radhakrishna Rayidi
Radhakrishna Rayidi

Reputation: 520

Unfortunately some times image buttons won't carry the data to your php page. I've faced these problem for many times. Later i realized that

<input type="image" />

is the problem. Try with

<input type="submit" height="200" width="200" onclick="document.getElementById('hidimgSrc').value=this.src;document.getElementById('myform').submit();" name="abc">

Upvotes: 1

Related Questions