GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   watermark pics on the server? (https://gfy.com/showthread.php?t=568187)

Pete-KT 01-25-2006 06:12 PM

watermark pics on the server?
 
anyone know of a program I can put on the server and have it watermark all my pics without downloading and reuploading my files?

Chio 01-25-2006 06:14 PM

Yes. Gallery 2

SmokeyTheBear 01-25-2006 07:47 PM

save the following as .htaccess
this is what the htaccess should look like ( put it in the directory with the pics

Code:

AddHandler watermarked .jpg
AddHandler watermarked .jpeg
AddHandler watermarked .gif
AddHandler watermarked .png

Action watermarked http://www.yoursite.com/watermarkscript.php

then the watermarkscript.php should look like this , it can reside anywhere , just point the htaccess to this file..

make a watermark.png and place it int he same directory as the watermarkscript.php

Code:

<?php
$watermark = "watermark.png";
$image = $_SERVER["PATH_TRANSLATED"];

if (empty($image)) die();

if (!file_exists($image)) {
  header("404 Not Found");
  echo "File Not Found."; die();
}

$outputType = getFileType($image);

watermark($image, $watermark, $outputType);

/**
  Outputs the image $source with $watermark in the lower right corner.
  @param $source the source image
  @param $watermark the watermark to apply
  @param $outputType the type to output as (png, jpg, gif, etc.)
                      defaults to the image type of $source if left blank
*/
function watermark($source, $watermark, $outputType="") {
  $sourceType = getFileType($source);
  $watermarkType = getFileType($watermark);

  if (empty($outputType)) $outputType = $sourceType;
 
  header("Content-type:image/$outputType");

  // Derive function names
  $createSource = "ImageCreateFrom".strtoupper($sourceType);
  $showImage = "Image".strtoupper($outputType);
  $createWatermark = "ImageCreateFrom".strtoupper($watermarkType);

  // Load original and watermark to memory
  $output = $createSource($source);
  $logo = $createWatermark($watermark);
  ImageAlphaBlending($output, true);

  // Find proper coordinates so watermark will be in the lower right corner
  $x = ImageSX($output) - ImageSX($logo);
  $y = ImageSY($output) - ImageSY($logo);

  // Display
  ImageCopy($output, $logo, $x, $y, 0, 0, ImageSX($logo), ImageSY($logo));
  $showImage($output);

  // Purge
  ImageDestroy($output);
  ImageDestroy($logo);
}

function getFileType($string) {
  $type = strtolower(eregi_replace("^(.*)\.","",$string));
  if ($type hahahaha "jpg") $type = "jpeg";
  return $type;
}

( hahaha should read == )

SmokeyTheBear 01-25-2006 07:50 PM

make sure you change that 3rd to last line that says "hahaha" to "==" without the quotes

Chio 01-25-2006 07:52 PM

Very cool Smokey.

SmokeyTheBear 01-25-2006 07:55 PM

Quote:

Originally Posted by Chio
Very cool Smokey.

yah i would like to modify it so you can make it only watermark pics when they are hotlinked or change the watermark to a different larger one , but im unsure of the htaccess

SmokeyTheBear 01-25-2006 07:56 PM

hopefully someone will modify it for us.

Chio 01-25-2006 08:00 PM

Quote:

Originally Posted by SmokeyTheBear
yah i would like to modify it so you can make it only watermark pics when they are hotlinked or change the watermark to a different larger one , but im unsure of the htaccess


Take a look at gallery 2 watermark code. It does that.

Example: http://www.sharkyfarts.com/gallery/d/1160-1/jetski.jpg

It should have skarkyfarts logo on the bottom.

Now click the link below and refresh to see the non hotlink version.

http://www.sharkyfarts.com/gallery/v...etski.jpg.html

EDIT: You can set different watermark files as well depending on what's happening... viewed on site, hotlinked, etc.

Grapesoda 01-25-2006 08:01 PM

Quote:

Originally Posted by Pete-KT
anyone know of a program I can put on the server and have it watermark all my pics without downloading and reuploading my files?


hit woj up . . . he scripted one for me

SmokeyTheBear 01-25-2006 08:24 PM

Quote:

Originally Posted by Chio
Take a look at gallery 2 watermark code. It does that.

Example: http://www.sharkyfarts.com/gallery/d/1160-1/jetski.jpg

It should have skarkyfarts logo on the bottom.

Now click the link below and refresh to see the non hotlink version.

http://www.sharkyfarts.com/gallery/v...etski.jpg.html

EDIT: You can set different watermark files as well depending on what's happening... viewed on site, hotlinked, etc.

:thumbsup :thumbsup

MikeVega 01-25-2006 08:31 PM

That's fucking cool ... that's exactly what pete was looking for ...:thumbsup

JoeMeca 01-25-2006 08:44 PM

thanks smoky!

Pete-KT 01-25-2006 10:01 PM

DAMM SMOKEY YOU ARE THE MAN, I owe you a drink in phoenix bro, thats exactly what i want. Thanks Bro


All times are GMT -7. The time now is 06:48 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123