mrheff Posted March 13, 2007 Share Posted March 13, 2007 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 Link to comment https://forums.phpfreaks.com/topic/42552-just-stretch-goddam-youplease-please-help/ Share on other sites More sharing options...
mrheff Posted March 13, 2007 Author Share Posted March 13, 2007 I forogot to mention it all works fine apart from the resize. Link to comment https://forums.phpfreaks.com/topic/42552-just-stretch-goddam-youplease-please-help/#findComment-206461 Share on other sites More sharing options...
boo_lolly Posted March 13, 2007 Share Posted March 13, 2007 take off the error supressor on this line: $watermark = @imagecreatefrompng($WatermarkFile) and replace it with this line: $watermark = imagecreatefrompng($WatermarkFile); notice the semicolon at the end?? Link to comment https://forums.phpfreaks.com/topic/42552-just-stretch-goddam-youplease-please-help/#findComment-206531 Share on other sites More sharing options...
mrheff Posted March 14, 2007 Author Share Posted March 14, 2007 yo yo yo, thanks for hittin me back boss, i tried it with no luck im afraid i also tried it with and without the @sign, no avail, ohw this will be the end of me. thanks again man. Link to comment https://forums.phpfreaks.com/topic/42552-just-stretch-goddam-youplease-please-help/#findComment-207270 Share on other sites More sharing options...
boo_lolly Posted March 14, 2007 Share Posted March 14, 2007 are you using gd library or image majick? Link to comment https://forums.phpfreaks.com/topic/42552-just-stretch-goddam-youplease-please-help/#findComment-207311 Share on other sites More sharing options...
mrheff Posted March 19, 2007 Author Share Posted March 19, 2007 im prety sure this uses GD, as it has very similar results to another sacript i was using... hgowever im not 100%sure, i think the server has the possibility of both though. Link to comment https://forums.phpfreaks.com/topic/42552-just-stretch-goddam-youplease-please-help/#findComment-210428 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.