Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
I can upload and resize image - I need to apply a PNG or GIF border
Old 07-30-2009, 01:27 AM I can upload and resize image - I need to apply a PNG or GIF border
Novice Talker

Posts: 14
Trades: 0
I'm trying to compile a few php scripts together. I'm not good enough to write my own PHP code yet.

There is a script here I would like to use:
http://bokehman.com/watermark

The error I am getting is "Cannot modify header information - headers already sent"

Here is the code so far:
PHP Code:
<form action="<?php echo $_server['php-self'];  ?>" method="post" enctype="multipart/form-data" id="something" class="uniForm">
        <input name="new_image" id="new_image" size="30" type="file" class="fileUpload" />
        <button name="submit" type="submit" class="submitButton">Upload/Resize Image</button>
</form>
<?php
        
if(isset($_POST['submit'])){
          if (isset (
$_FILES['new_image'])){
              
$imagename $_FILES['new_image']['name'];
              
$source $_FILES['new_image']['tmp_name'];
              
$target "images/".$imagename;
              
move_uploaded_file($source$target);
              
              
$imagepath $imagename;
              
$save "images/" $imagepath//This is the new file you saving
              
$file "images/" $imagepath//This is the original file

              
list($width$height) = getimagesize($file) ; 
                                                         
              
$modwidth 400
                                                         
              
$diff $width $modwidth;
                                                        
              
$modheight $height $diff
              
$tn imagecreatetruecolor($modwidth$modheight) ; 
              
$image imagecreatefromjpeg($file) ; 
              
imagecopyresampled($tn$image0000$modwidth$modheight$width$height) ; 
                                                        
              
imagejpeg($tn$save100) ; 

              
$save "images/sml_" $imagepath//This is the new file you saving
              
$file "images/" $imagepath//This is the original file

              
list($width$height) = getimagesize($file) ; 
                                                         
              
$modwidth 80
                                                         
              
$diff $width $modwidth;
                                                        
              
$modheight $height $diff
              
$tn imagecreatetruecolor($modwidth$modheight) ; 
              
$image imagecreatefromjpeg($file) ; 
              
imagecopyresampled($tn$image0000$modwidth$modheight$width$height) ; 
                                                        
              
imagejpeg($tn$save100) ; 
            
      
              
            echo 
"<img src='images/".$imagepath."'><br>"
        
          }
        }
?>
kagronick is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-30-2009, 03:59 PM Re: I can upload and resize image - I need to apply a PNG or GIF border
danielsolution's Avatar
Novice Talker

Posts: 9
Name: Daniel
Trades: 0
Try this:

PHP Code:
<?php
        
if(isset($_POST['submit'])){
          if (isset (
$_FILES['new_image'])){
              
$imagename $_FILES['new_image']['name'];
              
$source $_FILES['new_image']['tmp_name'];
              
$target "images/".$imagename;
              
move_uploaded_file($source$target);
              
              
$imagepath $imagename;
              
$save "images/" $imagepath//This is the new file you saving
              
$file "images/" $imagepath//This is the original file

              
list($width$height) = getimagesize($file) ; 
                                                         
              
$modwidth 400
                                                         
              
$diff $width $modwidth;
                                                        
              
$modheight $height $diff
              
$tn imagecreatetruecolor($modwidth$modheight) ; 
              
$image imagecreatefromjpeg($file) ; 
              
imagecopyresampled($tn$image0000$modwidth$modheight$width$height) ; 
                                                        
              
imagejpeg($tn$save100) ; 

              
$save "images/sml_" $imagepath//This is the new file you saving
              
$file "images/" $imagepath//This is the original file

              
list($width$height) = getimagesize($file) ; 
                                                         
              
$modwidth 80
                                                         
              
$diff $width $modwidth;
                                                        
              
$modheight $height $diff
              
$tn imagecreatetruecolor($modwidth$modheight) ; 
              
$image imagecreatefromjpeg($file) ; 
              
imagecopyresampled($tn$image0000$modwidth$modheight$width$height) ; 
                                                        
              
imagejpeg($tn$save100) ; 
              
            
$myImage =  $imagepath
        
          }
        }
?>
<form action="<?php echo $_server['php-self'];  ?>" method="post" enctype="multipart/form-data" id="something" class="uniForm">
        <input name="new_image" id="new_image" size="30" type="file" class="fileUpload" />
        <button name="submit" type="submit" class="submitButton">Upload/Resize Image</button>
</form>
<img src='images/<?=$myImage ?>'><br>
__________________
Daniel S.

Please login or register to view this content. Registration is FREE
Toronto
danielsolution is offline
Reply With Quote
View Public Profile
 
Old 07-30-2009, 04:01 PM Re: I can upload and resize image - I need to apply a PNG or GIF border
danielsolution's Avatar
Novice Talker

Posts: 9
Name: Daniel
Trades: 0
Just a quick look at it - if that doesnt do the job - let me know, I will write it for you, no problem.
__________________
Daniel S.

Please login or register to view this content. Registration is FREE
Toronto
danielsolution is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to I can upload and resize image - I need to apply a PNG or GIF border
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.93477 seconds with 12 queries