Jump to content

Just stretch goddam you!..........please please help........


mrheff

Recommended Posts

hi ther everyone.. im trying to get this scrip to resize its matermark to the six=ze of the original image, Ive swapped variables around countless times and im really stuck Can You help????

here is the scrip in its original context.....

<?php

function watermark($SourceFile, $WatermarkFile, $SaveToFile = NULL)

{

    $watermark = @imagecreatefrompng($WatermarkFile) 


    or exit('Cannot open the watermark file.');

    imageAlphaBlending($watermark, false);

    imageSaveAlpha($watermark, true);

    $image_string = @file_get_contents($SourceFile) 


    or exit('Cannot open image file.');

    $image = @imagecreatefromstring($image_string)

    or exit('Not a valid image format.');

    $imageWidth=imageSX($image);

    $imageHeight=imageSY($image);


    $watermarkWidth=imageSX($watermark);

    $watermarkHeight=imageSY($watermark);

    $coordinate_X = ( $imageWidth - 5) - ( $watermarkWidth);


    $coordinate_Y = ( $imageHeight - 5) - ( $watermarkHeight);

    imagecopy($image, $watermark, $coordinate_X, $coordinate_Y, 


        0, 0, $watermarkWidth, $watermarkHeight);

    if(!($SaveToFile)) header('Content-Type: image/jpeg');

    imagejpeg ($image, $SaveToFile, 100);


    imagedestroy($image);

    imagedestroy($watermark);

    if(!($SaveToFile)) exit;

}

?>

 

 

 

and heres how im calling it

 

<a href="processP.php?filename=',$file,'">portrait </a>

links to......

 

poceessP.php

<?php

$file= ($_GET['filename']);

// The image should be located in a non public directory

$image_location = "pics/$file";

// Locate the watermark file wherever you choose (remember PNG format)

$watermark_location = 'watermarks/landscape.png';

// Location where you want to save the created watermarked file

$save_watermarked_file_to = "lly_$file" ;

// Include the watermarking function file

require_once($_SERVER['DOCUMENT_ROOT'] . '/Carbon/admin/function_watermark.php');

// Watermark the image and save it to file

watermark($image_location, $watermark_location, $save_watermarked_file_to);

unlink ("batch/pics/$file");

echo '<a href=batch.php>back</a>';

?>

 

 

I know its only the top bit i need to worry about... but i thought this might help

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.