I have looked script for watermaking images permanent, not on the fly.
Becouse have'nt find any, I decided to try making one.
I'm not good on PHP (or ong english writing), but hope that maybe someone like to test it also.
There maybe many bugs, but I have used on couple hundred images with out problems. I dont take any responsibility, if this code messes your server or images, so be careful :roll:
And Big thanks for DJ Axion, whose script I have used as base of this script (with util, and picmgmt.php)
REMEMBER to take backup from all files that You are modifying
I have modified util.php, include/picmgmt.inc.php and lang/yourownlanguage.php (finnish.php on my situation)
1.
Lang/finnish.php (english or whatever languageYou are using)
Add new line after line 984 (text): 'select_album' => 'Select album',
Paste theese lines:
'watermarks' => 'Add watermaks',
'watermark_normal' => 'Resized images only',
'watermark_image' => 'Original sized only',
'watermark_both' => 'Original and resized images',
'watermark_wait' => 'Watermarking images...',
'watermark_continue_wait' => 'Continuing to watermarking originals and/or resized images...',
2. include/picmgmt.inc.php
Find this part of code (line 190 - 201 ?)
// Set mode of uploaded picture
chmod($dest_file, octdec($CONFIG['default_file_mode']));
// We check that the image is valid
$imginfo = getimagesize($dest_file);
if ($imginfo == null) {
$ERROR = $lang_errors['resize_failed'];
@unlink($dest_file);
return false;
} else {
return true;
}
}
Activate all after above code and past all from below
/**
* watermark_image()
*
* Create a file containing a watermarked image
*
* @param $src_file the source file
* @param $dest_file the destination file
* @param $new_size the size of the square within which the new image must fit
* @param $method the method used for image resizing //ainoastaan gd2
* @return 'true' in case of success
*/
function watermark($src_file)
{
global $CONFIG, $ERROR;
global $lang_errors;
$imginfo = getimagesize($src_file);
if ($imginfo == null)
return false;
// GD can only handle JPG & PNG images
if ($imginfo[2] != GIS_JPG && $imginfo[2] != GIS_PNG) {
$ERROR = $lang_errors['gd_file_type_err'];
return false;
}
// height/width
$srcWidth = $imginfo[0];
$srcHeight = $imginfo[1];
$destWidth = $srcWidth; //(int)($srcWidth / $ratio);
$destHeight = $srcHeight; //(int)($srcHeight / $ratio);
$dest_file = $src_file;
// Method for thumbnails creation
// switch ($method) {
// case "gd2" :
if (!function_exists('imagecreatefromjpeg')) {
cpg_die(CRITICAL_ERROR, 'PHP running on your server does not support the GD image library, check with your webhost if ImageMagick is installed', __FILE__, __LINE__);
}
if (!function_exists('imagecreatetruecolor')) {
cpg_die(CRITICAL_ERROR, 'PHP running on your server does not support GD version 2.x, please switch to GD version 1.x on the config page', __FILE__, __LINE__);
}
if ($imginfo[2] == GIS_JPG)
$src_img = imagecreatefromjpeg($src_file);
else
$src_img = imagecreatefrompng($src_file);
if (!$src_img) {
$ERROR = $lang_errors['invalid_image'];
return false;
} //duunataan wesileima
$dst_img = imagecreatetruecolor($destWidth, $destHeight);
/*$dst_img =*/ ImageAlphaBlending($dst_img, true) or die ("Could not alpha blend"); // Enable when on GD 2+
imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $destWidth, (int)$destHeight, $srcWidth, $srcHeight);
$logoImage = ImageCreateFromPNG('/your/full/path/to/galleria/include/logo.png'); // logo.png is a watermark it add's...
$logoW = ImageSX($logoImage);
$logoH = ImageSY($logoImage);
//where is the watermark displayed...
$pos = "bottomright";
if ($pos == "topleft") {
$src_x = 5;
$src_y = 5;
} else if ($pos == "topright") {
$src_x = $srcWidth - ($logoW + 2);
$src_y = 5;
} else if ($pos == "bottomleft") {
$src_x = 5;
$src_y = $srcHeight - ($logoH + 2);
} else if ($pos == "bottomright") {
$src_x = $srcWidth - ($logoW + 2);
$src_y = $srcHeight - ($logoH + 2);
}
ImageCopy($dst_img,$logoImage,$src_x,$src_y,0,0,$logoW,$logoH); //$dst_x,$dst_y,0,0,$logoW,$logoH);
imagejpeg($dst_img, $src_file, $CONFIG['jpeg_qual']);
imagedestroy($src_img);
imagedestroy($dst_img);
// We check that the image is valid
$imginfo = getimagesize($src_file);
if ($imginfo == null) {
$ERROR = $lang_errors['resize_failed'];
@unlink($src_file);
return false;
} else {
return true;
}
}
?>
I will post last part of modifications, after I have eat the Pizza, that is still warm :P
OK, Pizza is destroyed now.
3. util.php
Find line
function deleteorig()
Near line 206
Add new line Above text "function deleteorig()"
and paste code from below
function vesileimaathumbit()
{
global $picturetbl, $CONFIG, $lang_util_php;
$phpself = $_SERVER['PHP_SELF'];
$albumid = $_POST['albumid'];
$updatetype = $_POST['updatetype'];
$numpics = $_POST['numpics'];
$startpic = 0;
$startpic = $_POST['startpic'];
$query = "SELECT * FROM $picturetbl WHERE aid = '$albumid'";
$result = MYSQL_QUERY($query);
$totalpics = mysql_numrows($result);
if ($startpic == 0) {
// 0 - numpics
$num = $totalpics;
// Over picture limit
if ($totalpics > $numpics) $num = $startpic + $numpics;
} else {
// startpic - numpics
$num = $startpic + $numpics;
if ($num > $totalpics) $num = $totalpics;
}
$i = $startpic;
while ($i < $num) {
$image = $CONFIG['fullpath'] . mysql_result($result, $i, "filepath") . mysql_result($result, $i, "filename");
if ($updatetype == 0 || $updatetype == 2) {
$imagesize = getimagesize($image);
if (max($imagesize[0], $imagesize[1]) > $CONFIG['picture_width'] && $CONFIG['make_intermediate']) {
$image = $CONFIG['fullpath'] . mysql_result($result, $i, "filepath") . $CONFIG['normal_pfx'] . mysql_result($result, $i, "filename");
} else {
$image = $CONFIG['fullpath'] . mysql_result($result, $i, "filepath") . mysql_result($result, $i, "filename");
}
if (watermark($image)) {
print $image .' '. $lang_util_php['updated_succesfully'] . '!<br />'; //$normal .' '. $lang_util_php['updated_succesfully'] . '!<br />';
my_flush();
} else {
print $lang_util_php['error_create'] . ':$image<br />'; //$lang_util_php['error_create'] . ':$normal<br />';
my_flush();
}
}
if ($updatetype == 1 || $updatetype == 2) {
$image = $CONFIG['fullpath'] . mysql_result($result, $i, "filepath") . mysql_result($result, $i, "filename");
if (watermark($image)) {
print $image .' '. $lang_util_php['updated_succesfully'] . '!<br />'; //$normal .' '. $lang_util_php['updated_succesfully'] . '!<br />';
my_flush();
} else {
print $lang_util_php['error_create'] . ':$image<br />'; //$lang_util_php['error_create'] . ':$normal<br />';
my_flush();
}
}
++$i;
}
$startpic = $i;
if ($startpic < $totalpics) {
?>
<form action=<?php echo $phpself;
?> method="post">
<input type="hidden" name="action" value="continuewatermarks" />
<input type="hidden" name="numpics" value="<?php echo $numpics?>" />
<input type="hidden" name="startpic" value="<?php echo $startpic?>" />
<input type="hidden" name="updatetype" value="<?php echo $updatetype?>" />
<input type="hidden" name="albumid" value="<?php echo $albumid?>" />
<input type="submit" value="<?php print $lang_util_php['continue'];
?>" class="submit" /></form>
<?php
}
}
Between lines updatethumbs();
(last one, near line 358)
and filenametotitle(0);
(should be only few lines after "updatethumbs();" )
Paste this code
echo '<br /><a href="' . $phpself . '">' . $lang_util_php['back'] . '</a>';
} else if ($action == 'watermarks') {//tämä
global $picturetbl, $CONFIG;
print '<a href="' . $phpself . '">' . $lang_util_php['back'] . '</a><br />';
print '<h2>' . $lang_util_php['watermark_wait'] . '</h2>';
vesileimaathumbit();
echo '<br /><a href="' . $phpself . '">' . $lang_util_php['back'] . '</a>';
} else if ($action == 'continuewatermarks') {//tämä
print '<a href="' . $phpself . '">' . $lang_util_php['back'] . '</a><br />';
print '<h2>' . $lang_util_php['watermark_wait'] . '</h2>';
vesileimaathumbit();
echo '<br /><a href="' . $phpself . '">' . $lang_util_php['back'] . '</a>';
} else if ($action == 'title') {
echo '<a href="' . $phpself . '">' . $lang_util_php['back'] . '</a><br />';
print '<h2>' . $lang_util_php['titles_wait'] . '</h2>';
(yes, You should replace few lines. Yes, the lines are identical, but I dont know how to describe it beter in english :D )
Then You have to find thisprint '<br />';
starttable('100%', '<input type="radio" name="action" value="title" id="title" class="nobg" /><label for="title" accesskey="F" class="labelradio">' . $lang_util_php['filename_title'] . '</label> (1)');
(Near line 442)
On the empty line between, add new line and put this
starttable('100%', '<input type="radio" name="action" value="watermarks" id="watermarks" class="nobg" /><label for="watermarks" accesskey="w" class="labelradio">' . $lang_util_php['watermarks'] . '</label> (1)');
print '
<tr><td>
' . $lang_util_php['update_what'] . ' (2):<br />
<input type="radio" name="updatetype" value="0" id="thumb" class="nobg" /><label for="thumb" accesskey="w" class="labelradio">' . $lang_util_php['watermark_normal'] . '</label><br />
<input type="radio" name="updatetype" value="1" id="resized" class="nobg" /><label for="resized" accesskey="r" class="labelradio">' . $lang_util_php['watermark_image'] . '</label><br />
<input type="radio" name="updatetype" value="2" checked="checked" id="all" class="nobg" /><label for="all" accesskey="a" class="labelradio">' . $lang_util_php['watermark_both'] . '</label><br />
' . $lang_util_php['update_number'] . '
<input type="text" name="numpics" value="' . $defpicnum . '" size="5" /><br />
' . $lang_util_php['update_option'] . '<br /><br />
</td></tr>';
endtable();
print '<br />';
on new line that You just created.
If everything has been done fine, You can now add watermarks on albums by going to "Resize Pictures". there should be new section: "Add watermarks". Just select imagesizes You want to be watermarked, and at the bottom of page, select album what You are going to watermark images in.
There should also be .PNG image "called logo.png". In my case, logo.png is on includes folder. If your logo.png is 30% trnsparent, then You get transparent watermark
You should also change the full path to point correct file (logo.png, or what ever Your watermark image is called)
Hope that I remember to put everything in it :?
Great job! Will try it out later.
srry if this is a newbie question but where is the resize image thing located?
Quote from: "Zcaithaca"srry if this is a newbie question but where is the resize image thing located?
When you are logged in as an admin, the script has two modes of operation : Admin mode & User mode. You switch between Admin & User mode by clicking on the corresponding link in the menu bar at the top of the screen.
When you are in admin mode, you can administer your gallery and the following menu bar appears :
(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fcoppermine.sourceforge.net%2Fimages%2Fadmin_mode_bar.gif&hash=dde079dcd50258d68959d663e3fd5aa90a74a25a)
Resize Pictures is located on menu bar. It is not showing on above image, becouse ist from an older version of Coppermine, but it is between "Batch add pictures" and "My profile" buttons.
Addition to above, the link is not shown in the hardwired theme.
ok thx im using the hardwired so ill change it
anyone have a sample gallery that is using this? for us to see?
Will the watermark covert the full pic? or is it just on a corner of a picture?
Thanks :)
Here is one gallery where I'm using it.
http://www.jarnokalliomaki.com/index_carry.shtml
There are sometimes pics with out watermarks, becouse pics are added after watermarking that album.
You could ofcource move images to some temporary album and watermark pics in there. that way You do not get Your images watermarked many times and loose transparency of watermark.
On the other albums there are also watermarked pics done by Our old imagegallery, but most of watermarks are done on old gallery with imagemagick.
I will try to add same watermarking on "batch add pictures" page, so I get all new images automatically watermarked, while waiting CPG 1.3 :D
Quote from: "photoman13"Will the watermark covert the full pic? or is it just on a corner of a picture?
Watermark will convert ful pic.
It will be on corner. You can decide corner You want, by changing it on include/picmgmt.inc.php .
Can you zip up the relevant files and post a link OR sent it to me
I will incorporate it into the main CPG (of course your name will be in the credits)
Hello Tarique
Here is link to zip
Permanent Watermark with GD2 (http://www.sammy.fi/coppermine_gd2wm/GD2_Watermarking.zip)
This link will work for now, but I'm doing some changes on my website, so I dont know how long it will be there. But at least for couple weeks.
You could possible do some check on those code changes. I think there are some duplications on variable names on watermark_image() function on /include/picmgmt.inc.php.
Thanks - I have got the file, will look into the code and incorporate accordingly
Sammy,
awesome coding there.. I got it working on 2 of my galleries :)
question: so now that it's installed... whenever someone uploads a photo is it automatically 'watermarked' or do we always have to go in and do it manually?
Sorry.. I haven't had any new photos to test that on... and thought I would ask :)
Thanks again for the code.. it was easy to install :)
As for the Hardwire theme, it was still easy to do, just changed the theme back to default and did the resizing (watermarking) there.. then changed it back when I was done :)
@photoman,
you don't have to change theme, just type in the url direct, i.e., yoursite.com/gallery/util.php
Quote from: "photoman13"Sammy,
awesome coding there.. I got it working on 2 of my galleries :)
question: so now that it's installed... whenever someone uploads a photo is it automatically 'watermarked' or do we always have to go in and do it manually?
It does not add watermark automatically :cry:
I'm trying to get it work automatically when adding new pics, and if I succes in the process, I'll post code it here.
If You do keep albums, where You are adding pics, You need to create some temporary album, where to upload pics and watermark those in that album and move all images after watermarking to desired album.
If You Just add more pics to some album and watermark pics there, Your older (allready watermarked pics) are going to loose some of quality and transparency of Your logo.png watermark, becouse it just stamps watermark again in all pics.
thanks Sammy :)
I'll just do it that way til you get that process complete :)
it's still a great addition :)
Quote from: "photoman13"Sammy,
question: so now that it's installed... whenever someone uploads a photo is it automatically 'watermarked' or do we always have to go in and do it manually?
:D :D :D
By the power of friday Sauna and cold beer after it, here it comes...
First I need to say: This is
NOT tested yet with couple hundreds of pics, but only few test images.
1You need to add all modifications mentioned on this topics 1st and 2nd post.
2Open Your modified /include/picmgmt.inc.php and find line 34. It should look like this:
return false;
3Add theese new lines after line 34
//Adds watermarks to new images
if (!watermark($image)) //this is for full size image
return false;
if (!watermark($normal)) //this is for intermediate size image
return false;
Thats it.
Now You have watermark automatic :)
Just to make it sure, Your first 42 lines of code should be look like this:.
<?php
// ------------------------------------------------------------------------- //
// Coppermine Photo Gallery 1.2.1 //
// ------------------------------------------------------------------------- //
// Copyright (C) 2002,2003 Gregory DEMAR //
// http://www.chezgreg.net/coppermine/ //
// ------------------------------------------------------------------------- //
// Updated by the Coppermine Dev Team //
// (http://coppermine.sf.net/team/) //
// see /docs/credits.html for details //
// ------------------------------------------------------------------------- //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// ------------------------------------------------------------------------- //
// Add a picture to an album
function add_picture($aid, $filepath, $filename, $title = '', $caption = '', $keywords = '', $user1 = '', $user2 = '', $user3 = '', $user4 = '', $category = 0, $raw_ip = '', $hdr_ip = '')
{
global $CONFIG, $ERROR, $USER_DATA, $PIC_NEED_APPROVAL;
global $lang_errors;
$image = $CONFIG['fullpath'] . $filepath . $filename;
$normal = $CONFIG['fullpath'] . $filepath . $CONFIG['normal_pfx'] . $filename;
$thumb = $CONFIG['fullpath'] . $filepath . $CONFIG['thumb_pfx'] . $filename;
$imagesize = getimagesize($image);
if (!file_exists($thumb))
if (!resize_image($image, $thumb, $CONFIG['thumb_width'], $CONFIG['thumb_method'], $CONFIG['thumb_use']))
return false;
if (max($imagesize[0], $imagesize[1]) > $CONFIG['picture_width'] && $CONFIG['make_intermediate'] && !file_exists($normal))
if (!resize_image($image, $normal, $CONFIG['picture_width'], $CONFIG['thumb_method'], $CONFIG['thumb_use']))
return false;
//Adds watermarks to new images
if (!watermark($image)) //this is for full size image
return false;
if (!watermark($normal)) //this is for intermediate size image
return false;
$image_filesize = filesize($image);
PS.
Remember to CHMOD every pic uploaded with FTP to 666, or You'll get some errors becouse You have not give apache/PHP right to save modified pics.
Tarique
I will change the zip file for You, but I will do it on monday, when Im on work
Hey Sammy :)
good work :)
I'm gonna go test that myself right now :)
I'll let ya know :)
awesome Sammy.. it works for me :)
Thanks again for this great mod!!! :)
*ahem*
okay, it's 1:30 am and I've got 5 and a half hours of sleep ahead of me so I wanna make this quick...
I've installed the mod on my gallery... I'm not very good at PHP, but I'm learning steadily.
When I try uploading a foto normally (with watermark on upload) it gives me the following error:
QuoteDe foto 'albums/userpics/10001/592314802.jpg' kan niet ingevoegd worden in het album.
Warning: getimagesize(albums/userpics/10001/normal_592314802.jpg): failed to open stream: No such file or directory in /home/vuurwerk/public_html/galleryhidden/include/picmgmt.inc.php on line 224
now... it could just be something stupid I did... I dunno..
thanx in advance :D
Burpee
Thanks - the whole thing of
1)watermark image on upload,
2)where to place the watermark,
3)which file to use for watermark
4)which files to watermark
Needs to be admin settable - are you feeling upto doing that as well?
Once you are thru I intend to write a watermark function for Image MagicK and we would have completed the Watermark feature :)
Quote from: "tarique"Thanks - the whole thing of
1)watermark image on upload,
2)where to place the watermark,
3)which file to use for watermark
4)which files to watermark
Needs to be admin settable - are you feeling upto doing that as well?
Once you are thru I intend to write a watermark function for Image MagicK and we would have completed the Watermark feature :)
I dont know if I have knowledge to do it, but I will try.
Correct if I go wrong in first step: config values should be saved into table named "someprefix_config"?
And I think those settings should be settable from config.php?
Quote from: "Burpee"
When I try uploading a foto normally (with watermark on upload) it gives me the following error:
QuoteDe foto 'albums/userpics/10001/592314802.jpg' kan niet ingevoegd worden in het album.
Warning: getimagesize(albums/userpics/10001/normal_592314802.jpg): failed to open stream: No such file or directory in /home/vuurwerk/public_html/galleryhidden/include/picmgmt.inc.php on line 224
now... it could just be something stupid I did... I dunno..
Hi Burbee
I'll try to check it.
What does "De foto 'albums/userpics/10001/592314802.jpg' kan niet ingevoegd worden in het album" mean in english?
Quote from: "Sammy"I dont know if I have knowledge to do it, but I will try.
Correct if I go wrong in first step: config values should be saved into table named "someprefix_config"?
And I think those settings should be settable from config.php?
As long as you are willing to learn we will be willing to help :) Here are some tips to get you started
To add an option to the Config screen you need to
1) edit the language file for example open english.php and search for "config.php" below that you will find all the arrays which are needed to create the config screen. Since you will be mostly adding "yes" "no" options what you need to add is something like this
array('Watermark Image on upload', 'enable_watermark', 1),
2) You need to add a record to the cpg_config table with name = "enable_watermark"
3) Then in your scripts the state of "enable_watermark" will be available in
$CONFIG['enable_watermark']
Try it out and let me know if you need further help :)
@Tarique
Thanks for tips!
I have now done it to admin settings.
Now I try to get those watermark scripts to understand those admin settings.
By the way, if You have looked modified picmgmt.inc.php, tell Me if next part is needed at all?
$imginfo = getimagesize($src_file);
if ($imginfo == null) {
$ERROR = $lang_errors['resize_failed'];
@unlink($src_file);
return false;
} else {
return true;
}
I wonder it becouse just checked about @unlink() function, and noticed that it's for deleting a file.
@ Burpee
Is there possibility, that image that gave error, is so small that there are no original and normal (resized) image?
I've got same error, when trying to upload small pic.
We need to make check in watermarking, so there wont come that error, if pic is smaller than size of intermediate picture.
Quote from: "Sammy"Quote from: "Burpee"
When I try uploading a foto normally (with watermark on upload) it gives me the following error:
QuoteDe foto 'albums/userpics/10001/592314802.jpg' kan niet ingevoegd worden in het album.
Warning: getimagesize(albums/userpics/10001/normal_592314802.jpg): failed to open stream: No such file or directory in /home/vuurwerk/public_html/galleryhidden/include/picmgmt.inc.php on line 224
now... it could just be something stupid I did... I dunno..
Hi Burbee
I'll try to check it.
What does "De foto 'albums/userpics/10001/592314802.jpg' kan niet ingevoegd worden in het album" mean in english?
I think it was just an error I made somehow. It's working fine now anyway. Maybe I was doing something stupid but I wasn't entirely awake when I wrote the previous post, sorry about that.
I'm loving the mod tho...
one aspect I am worried about, is it still possible to upload movies? I know there's already a discussion about this in "Coppermine should also allow video" but I think that the creator of the watermark mod has a better perspective on possible solutions :D
Seeing as I'm not very experienced in php I might be sounding stupid as hell, but isn't it just as simple as just telling the watermark code to ignore all formats other than jpg and png?
When I upload a movie it just tells me (roughly translated):
QuoteThe photo 'albums/userpics/10001/cube1.mpg' cannot be inserted to the album.
If you are using the GD image library only the formats JPG and PNG are allowed.
But to be quite honest I just realized this is the first time I've tested the movie upload function.... hmm... if only I had more time so I could test everything every time I wanted to... but hey time is scarce
@Burpee
I cant help You with that movie uploading right now.
I think it can be quite easy to by pass watermarking of anything else, than JPG or PNG, but not sure about it.
Maybe Tarique or some other Guru can tell, if putting "break" or some other "get a way from this watermarking function"-command on watermark scripts imagetype checking part would do that?
// GD can only handle JPG & PNG images
if ($imginfo[2] != GIS_JPG && $imginfo[2] != GIS_PNG) {
$ERROR = $lang_errors['gd_file_type_err'];
return false;
I'm working now with those admin settings on watermarking.
There will be (actually I have done that part allready) easy way to turn watermarking off from the setings. So at least You can drop watermarking off when uploading movies and turn it back when you want it.
Quote from: "tarique"Thanks - the whole thing of
1)watermark image on upload,
2)where to place the watermark,
3)which file to use for watermark
4)which files to watermark
Needs to be admin settable - are you feeling upto doing that as well?
Once you are thru I intend to write a watermark function for Image MagicK and we would have completed the Watermark feature :)
@Tarique
It's done with Your great tips, that lead me to succes :D
Dont know about how clean code it is, but it's working.
I updated the zip file (http://www.sammy.fi/coppermine_gd2wm/GD2_Watermarking.zip) and added 4 SQL insert lines in txt file.
There needs to be done check for image size.
If (image size <= intermediate image size on settings) {
no need to watermark intermediateprefix_imagename;
Break (or some command to stop watermarking of this pic);
}
Quote from: "Sammy"@Tarique It's done with Your great tips, that lead me to succes :D
Dont know about how clean code it is, but it's working.
Great work!! 8)
I will look into the code in a day or two I am busy with some interviews right now
Thanks
For CPG users who wants to add GD2 watermark function on their gallery.
This MOD uses GD2!
Here is how to mod (original) CPG 1.2.1 to be able to add watermark automatically on new pics and by choise on all pics in selected album.
This is quite long post, but it takes only about 10 minutes to add this mod
Files that needs to be modified:
Lang/english.php
include/picmgmt.inc.php
util.php
config.php
(and 4 SQL command to execute)
REMEMBER to take backup from all files that You are modifying
You can download modified files in a zip file from here (http://www.sammy.fi/coppermine_gd2wm/GD2_Watermarking.zip), or You can do modifications by Your self.
1.
Open file Lang/english.php
Find this:'th_wd' => 'Width',
Add this after it
'wm_bottomright' => 'Bottom right',
'wm_bottomleft' => 'Bottom left',
'wm_topleftt' => 'Up left',
'wm_topright' => 'Up Right',
'wm_both' => 'Both',
'wm_original' => 'Original',
'wm_resized' => 'Resized',
Find this:array('Enable debug mode', 'debug_mode', 1),
Add this after it
'Image watermarking',
array('Watermark Image on upload', 'enable_watermark', 1),
array('Where to place the watermark', 'where_put_watermark', 8),
array('which files to watermark', 'which_files_to_watermark', 9),
array('Which file to use for watermark', 'watermark_file', 0),
Find this:'select_album' => 'Select album',
Add this after it
'watermarks' => 'Add watermaks',
'watermark_normal' => 'Resized images only',
'watermark_image' => 'Original sized only',
'watermark_both' => 'Original and resized images',
'watermark_wait' => 'Watermarking images...',
'watermark_continue_wait' => 'Continuing to watermarking originals and/or resized images...',
2.
Open file include/picmgmt.inc.php
Find this:$image_filesize = filesize($image);
Add this before it
//Adds watermarks to new images
if ($CONFIG['enable_watermark'] == '1' && $CONFIG['which_files_to_watermark'] == 'both' || $CONFIG['which_files_to_watermark'] == 'original') {
if (!watermark($image)) //this is for full size image
return false;
}
if ($CONFIG['enable_watermark'] == '1' && $CONFIG['which_files_to_watermark'] == 'both' || $CONFIG['which_files_to_watermark'] == 'resized') {
if (!watermark($normal)) //this is for intermediate size image
return false;
}
Find this:?>
Add this before it
/**
* watermark_image()
*
* Create a file containing a watermarked image
*
* @param $src_file the source file
* @param $dest_file the destination file
* @param $new_size the size of the square within which the new image must fit
* @param $method the method used for image resizing //ainoastaan gd2
* @return 'true' in case of success
*/
function watermark($src_file)
{
global $CONFIG, $ERROR;
global $lang_errors;
$imginfo = getimagesize($src_file);
if ($imginfo == null)
return false;
// GD can only handle JPG & PNG images
if ($imginfo[2] != GIS_JPG && $imginfo[2] != GIS_PNG) {
$ERROR = $lang_errors['gd_file_type_err'];
return false;
}
// height/width
$srcWidth = $imginfo[0];
$srcHeight = $imginfo[1];
/* if ($thumb_use == 'ht') {
$ratio = $srcHeight / $new_size;
} elseif ($thumb_use == 'wd') {
$ratio = $srcWidth / $new_size;
} else {
$ratio = max($srcWidth, $srcHeight) / $new_size;
}
$ratio = max($ratio, 1.0);*/
$destWidth = $srcWidth; //(int)($srcWidth / $ratio);
$destHeight = $srcHeight; //(int)($srcHeight / $ratio);
$dest_file = $src_file;
// Method for thumbnails creation
// switch ($method) {
// case "gd2" :
if (!function_exists('imagecreatefromjpeg')) {
cpg_die(CRITICAL_ERROR, 'PHP running on your server does not support the GD image library, check with your webhost if ImageMagick is installed', __FILE__, __LINE__);
}
if (!function_exists('imagecreatetruecolor')) {
cpg_die(CRITICAL_ERROR, 'PHP running on your server does not support GD version 2.x, please switch to GD version 1.x on the config page', __FILE__, __LINE__);
}
if ($imginfo[2] == GIS_JPG)
$src_img = imagecreatefromjpeg($src_file);
else
$src_img = imagecreatefrompng($src_file);
if (!$src_img) {
$ERROR = $lang_errors['invalid_image'];
return false;
} //duunataan wesileima
$dst_img = imagecreatetruecolor($destWidth, $destHeight);
/*$dst_img =*/ ImageAlphaBlending($dst_img, true) or die ("Could not alpha blend"); // Enable when on GD 2+
imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $destWidth, (int)$destHeight, $srcWidth, $srcHeight);
$logoImage = ImageCreateFromPNG($CONFIG['watermark_file']);
$logoW = ImageSX($logoImage);
$logoH = ImageSY($logoImage);
//where is the watermark displayed...
$pos = $CONFIG['where_put_watermark'];
if ($pos == "topleft") {
$src_x = 5;
$src_y = 5;
} else if ($pos == "topright") {
$src_x = $srcWidth - ($logoW + 5);
$src_y = 5;
} else if ($pos == "bottomleft") {
$src_x = 5;
$src_y = $srcHeight - ($logoH + 5);
} else if ($pos == "bottomright") {
$src_x = $srcWidth - ($logoW + 5);
$src_y = $srcHeight - ($logoH + 5);
}
ImageCopy($dst_img,$logoImage,$src_x,$src_y,0,0,$logoW,$logoH); //$dst_x,$dst_y,0,0,$logoW,$logoH);
imagejpeg($dst_img, $src_file, $CONFIG['jpeg_qual']);
imagedestroy($src_img);
imagedestroy($dst_img);
// break;
//}
// Set mode of uploaded picture
// We check that the image is valid
$imginfo = getimagesize($src_file);
if ($imginfo == null) {
$ERROR = $lang_errors['resize_failed'];
@unlink($src_file);
return false;
} else {
return true;
}
}
3.
Open File util.php
Find this: function deleteorig()
Add this before it
function vesileimaathumbit() //watermarkthumbs
{
global $picturetbl, $CONFIG, $lang_util_php;
$phpself = $_SERVER['PHP_SELF'];
$albumid = $_POST['albumid'];
$updatetype = $_POST['updatetype'];
$numpics = $_POST['numpics'];
$startpic = 0;
$startpic = $_POST['startpic'];
$query = "SELECT * FROM $picturetbl WHERE aid = '$albumid'";
$result = MYSQL_QUERY($query);
$totalpics = mysql_numrows($result);
if ($startpic == 0) {
// 0 - numpics
$num = $totalpics;
// Over picture limit
if ($totalpics > $numpics) $num = $startpic + $numpics;
} else {
// startpic - numpics
$num = $startpic + $numpics;
if ($num > $totalpics) $num = $totalpics;
}
$i = $startpic;
while ($i < $num) {
$image = $CONFIG['fullpath'] . mysql_result($result, $i, "filepath") . mysql_result($result, $i, "filename");
if ($updatetype == 0 || $updatetype == 2) {
$imagesize = getimagesize($image);
if (max($imagesize[0], $imagesize[1]) > $CONFIG['picture_width'] && $CONFIG['make_intermediate']) {
$image = $CONFIG['fullpath'] . mysql_result($result, $i, "filepath") . $CONFIG['normal_pfx'] . mysql_result($result, $i, "filename");
} else {
$image = $CONFIG['fullpath'] . mysql_result($result, $i, "filepath") . mysql_result($result, $i, "filename");
}
if (watermark($image)) {
print $image .' '. $lang_util_php['updated_succesfully'] . '!<br />'; //$normal .' '. $lang_util_php['updated_succesfully'] . '!<br />';
my_flush();
} else {
print $lang_util_php['error_create'] . ':$image<br />'; //$lang_util_php['error_create'] . ':$normal<br />';
my_flush();
}
}
if ($updatetype == 1 || $updatetype == 2) {
$image = $CONFIG['fullpath'] . mysql_result($result, $i, "filepath") . mysql_result($result, $i, "filename");
if (watermark($image)) {
print $image .' '. $lang_util_php['updated_succesfully'] . '!<br />'; //$normal .' '. $lang_util_php['updated_succesfully'] . '!<br />';
my_flush();
} else {
print $lang_util_php['error_create'] . ':$image<br />'; //$lang_util_php['error_create'] . ':$normal<br />';
my_flush();
}
}
++$i;
}
$startpic = $i;
if ($startpic < $totalpics) {
?>
<form action=<?php echo $phpself;
?> method="post">
<input type="hidden" name="action" value="continuewatermarks" />
<input type="hidden" name="numpics" value="<?php echo $numpics?>" />
<input type="hidden" name="startpic" value="<?php echo $startpic?>" />
<input type="hidden" name="updatetype" value="<?php echo $updatetype?>" />
<input type="hidden" name="albumid" value="<?php echo $albumid?>" />
<input type="submit" value="<?php print $lang_util_php['continue'];
?>" class="submit" /></form>
<?php
}
}
Find this:filenametotitle(0);
Add this before it
echo '<br /><a href="' . $phpself . '">' . $lang_util_php['back'] . '</a>';
} else if ($action == 'watermarks') {//tämä
global $picturetbl, $CONFIG;
print '<a href="' . $phpself . '">' . $lang_util_php['back'] . '</a><br />';
print '<h2>' . $lang_util_php['watermark_wait'] . '</h2>';
vesileimaathumbit(); //watermarkthumbs
echo '<br /><a href="' . $phpself . '">' . $lang_util_php['back'] . '</a>';
} else if ($action == 'continuewatermarks') {//tämä
print '<a href="' . $phpself . '">' . $lang_util_php['back'] . '</a><br />';
print '<h2>' . $lang_util_php['watermark_wait'] . '</h2>';
vesileimaathumbit(); //watermarkthumbs
Find this:starttable('100%', '<input type="radio" name="action" value="title" id="title" class="nobg"
(only part of that line)
Add this before it
//This is for watermarking
starttable('100%', '<input type="radio" name="action" value="watermarks" id="watermarks" class="nobg" /><label for="watermarks" accesskey="w" class="labelradio">' . $lang_util_php['watermarks'] . '</label> (1)');
print '
<tr><td>
' . $lang_util_php['update_what'] . ' (2):<br />
<input type="radio" name="updatetype" value="0" id="thumb" class="nobg" /><label for="thumb" accesskey="w" class="labelradio">' . $lang_util_php['watermark_normal'] . '</label><br />
<input type="radio" name="updatetype" value="1" id="resized" class="nobg" /><label for="resized" accesskey="r" class="labelradio">' . $lang_util_php['watermark_image'] . '</label><br />
<input type="radio" name="updatetype" value="2" checked="checked" id="all" class="nobg" /><label for="all" accesskey="a" class="labelradio">' . $lang_util_php['watermark_both'] . '</label><br />
' . $lang_util_php['update_number'] . '
<input type="text" name="numpics" value="' . $defpicnum . '" size="5" /><br />
' . $lang_util_php['update_option'] . '<br /><br />
</td></tr>';
endtable();
print '<br />';
4.
Open file config.php
Find this:function create_form(&$data)
Add this above it
// Added for allowing user to select where to add watermarks on pics...
function form_watermark($text, $name)
{
global $CONFIG, $lang_config_php;
$value = $CONFIG[$name];
$bottomright_selected = ($value == 'bottomright') ? 'selected' : '';
$bottomleft_selected = ($value == 'bottomleft') ? 'selected' : '';
$topleftt_selected = ($value == 'topleftt') ? 'selected' : '';
$topright_selected = ($value == 'topright') ? 'selected' : '';
echo <<<EOT
<tr>
<td class="tableb">
$text
</td>
<td class="tableb" valign="top">
<select name="$name" class="listbox">
<option value="bottomright" $bottomright_selected>{$lang_config_php['wm_bottomright']}</option>
<option value="bottomleft" $bottomleft_selected>{$lang_config_php['wm_bottomleft']}</option>
<option value="topleftt" $topleftt_selected>{$lang_config_php['wm_topleftt']}</option>
<option value="topright" $topright_selected>{$lang_config_php['wm_topright']}</option>
</select>
</td>
</tr>
EOT;
}
// Added for allowing user to select which files to watermark...
function form_watermark2($text, $name)
{
global $CONFIG, $lang_config_php;
$value = $CONFIG[$name];
$both_selected = ($value == 'both') ? 'selected' : '';
$original_selected = ($value == 'original') ? 'selected' : '';
$resized_selected = ($value == 'resized') ? 'selected' : '';
echo <<<EOT
<tr>
<td class="tableb">
$text
</td>
<td class="tableb" valign="top">
<select name="$name" class="listbox">
<option value="both" $both_selected>{$lang_config_php['wm_both']}</option>
<option value="original" $original_selected>{$lang_config_php['wm_original']}</option>
<option value="resized" $resized_selected>{$lang_config_php['wm_resized']}</option>
</select>
</td>
</tr>
EOT;
}
Find this:// Add triple dropdwon later - put back in for compatibility reasons
Few lines below isdie('Invalid action');
Now we need to paste this
//Watermark place
case 8 :
form_watermark($element[0], $element[1]);
break;
//Which filest to watermark
case 9 :
form_watermark2($element[0], $element[1]);
break;
case 10 :
// do nothing
break;
default:
between them.
After You have done it, it should look like this (I have put couple lines befor and after those lines in this example (hoppe You got it, becouse of My poor english :?
// Thumbnail scaling
case 7 :
form_scale($element[0], $element[1]);
break; // Add triple dropdwon later - put back in for compatibility reasons
//Watermark place
case 8 :
form_watermark($element[0], $element[1]);
break;
//Which filest to watermark
case 9 :
form_watermark2($element[0], $element[1]);
break;
case 10 :
// do nothing
break;
default:
die('Invalid action');
} // switch
} else {
form_label($element);
5.
Then You need to execute theese SQL commands with phpMyAdmin or Webmin, etc.
insert into cpg11d_config (name, value) values ('enable_watermark', '1');
insert into cpg11d_config (name, value) values ('where_put_watermark', 'bottomright');
insert into cpg11d_config (name, value) values ('watermark_file', '/your/full/path/to/logo.png');
insert into cpg11d_config (name, value) values ('which_files_to_watermark', 'both');
Thats it. Now You can go to setting and set it up.
Actually You need to go there, before trying to add new pics.
You have to chage 'Which file to use for watermark' to point in Your ow transparen logo.png file that is used as watermark.
There is no check for Your intermediate sized pictures, so if Your pics are smaller that intermediate pic size, You'll get errors for no image found.[b/]
There are some solution to come for that problem.
This should contain every modification I have made.
hello sammy,
I tried your changes on a new just installed photo album, then when trying to upload the photo;s I got this two messages...
Warning: getimagesize(): Unable to access albums/userpics/normal_strand-0030.jpg in /home/httpd/vhosts/partypicas.nl/httpdocs/copper/include/picmgmt.inc.php on line 231
Warning: getimagesize(albums/userpics/normal_strand-0030.jpg): failed to open stream: No such file or directory in /home/httpd/vhosts/partypicas.nl/httpdocs/copper/include/picmgmt.inc.php on line 231
It's some hours and reinstallations later.... and still the same problem...
Have you got any idea's ???
Reinier
sorry,
I have read it here before, the resizing was the problem,
my imported images were smaller than the risize sizes....
so the problem is solved...
or maybe it is possible to make somewhere an if parameter, when the original is smaller than the risize size....
ps I'm an absolute no-no in php....
Reinier
Quote from: "raindeer"sorry,
I have read it here before, the resizing was the problem,
my imported images were smaller than the risize sizes....
or maybe it is possible to make somewhere an if parameter, when the original is smaller than the risize size....
Reinier
@raindeer
I am working with that image size problem, but i'm not a guru PHP, so it takes time :(
I hope I get it tonight
Hi,
i tried it but i got this error when i tried to Make the settings from control panel
Watermarking images...
Warning: imagesx(): supplied argument is not a valid Image resource in /home/content/d/o/c/docarabiacom/html/cpg/include/picmgmt.inc.php on line 275
Warning: imagesy(): supplied argument is not a valid Image resource in /home/content/d/o/c/docarabiacom/html/cpg/include/picmgmt.inc.php on line 276
Warning: imagecopy(): supplied argument is not a valid Image resource in /home/content/d/o/c/docarabiacom/html/cpg/include/picmgmt.inc.php on line 293
albums/userpics/infarct.jpg updated succesfully!
Warning: imagesx(): supplied argument is not a valid Image resource in /home/content/d/o/c/docarabiacom/html/cpg/include/picmgmt.inc.php on line 275
Warning: imagesy(): supplied argument is not a valid Image resource in /home/content/d/o/c/docarabiacom/html/cpg/include/picmgmt.inc.php on line 276
Warning: imagecopy(): supplied argument is not a valid Image resource in /home/content/d/o/c/docarabiacom/html/cpg/include/picmgmt.inc.php on line 293
albums/userpics/infarct.jpg updated succesfully!
Warning: imagesx(): supplied argument is not a valid Image resource in /home/content/d/o/c/docarabiacom/html/cpg/include/picmgmt.inc.php on line 275
Warning: imagesy(): supplied argument is not a valid Image resource in /home/content/d/o/c/docarabiacom/html/cpg/include/picmgmt.inc.php on line 276
Warning: imagecopy(): supplied argument is not a valid Image resource in /home/content/d/o/c/docarabiacom/html/cpg/include/picmgmt.inc.php on line 293
albums/userpics/art_normal.jpg updated succesfully!
Warning: imagesx(): supplied argument is not a valid Image resource in /home/content/d/o/c/docarabiacom/html/cpg/include/picmgmt.inc.php on line 275
Warning: imagesy(): supplied argument is not a valid Image resource in /home/content/d/o/c/docarabiacom/html/cpg/include/picmgmt.inc.php on line 276
Warning: imagecopy(): supplied argument is not a valid Image resource in /home/content/d/o/c/docarabiacom/html/cpg/include/picmgmt.inc.php on line 293
albums/userpics/art_normal.jpg updated succesfully!
I am sorry I don't get what the problem is if it is just a question of normal_ not being present put a @in front and the warning will not be displayed - if this hack is not acceptable then do a print_r($CONFIG)
Look up which value you want to test for and put an if condition
@Tarique
I have tried to add an if condition for watermarkin normal sized pics
I was thinking something like
if (max($imagesize[0], $imagesize[1]) > $CONFIG['picture_width'] && $CONFIG['make_intermediate'] && !file_exists($normal) {
if ($CONFIG['enable_watermark'] == '1' && $CONFIG['which_files_to_watermark'] == 'both' || $CONFIG['which_files_to_watermark'] == 'resized') {
if (!watermark($normal)) //this is for intermediate size image
return false;
}
}
in add_picture function where it triggers watermarking for new pics.
What does the ! mark do before !file_exists function in first if condition above? :oops:
the ! before any condition negates it. In other words ! is short hand for "NOT"
Quote from: "Nawaf"Hi,
i tried it but i got this error when i tried to Make the settings from control panel
Watermarking images...
I dont understand, how You get it from settings panel.
Check that You have modify right files.
hi, I just install the Newest MOD. I get the following erro
Parse error: parse error, expecting `','' or `';'' in /usr/home/ushuaren/public_html/gallery/config.php on line 297
I appreciate your help!
Quote from: "uny"hi, I just install the Newest MOD. I get the following erro
Parse error: parse error, expecting `','' or `';'' in /usr/home/ushuaren/public_html/gallery/config.php on line 297
I appreciate your help!
Problem fixed, but I have another two questions:
1. I just noticed that all the sudden, all the YES and NO settings in the Setting can't be chose.
I can't select Neither Yes or No. it's all Blank.
2. If I add some new images to the album, after I upload them, is there a way to Watermark the NEW images only?
Please let me know the solution if there is any!
Thanks for your MOD!
you haven't applied the mod correctly. Undo all your modifications (restore the files from the original coppermine package if necessary) and re-apply the mod.
GauGau
Quote from: "gaugau"you haven't applied the mod correctly. Undo all your modifications (restore the files from the original coppermine package if necessary) and re-apply the mod.
GauGau
Thanks GauGau for your reply, but all I did is Upload the PHP adn SQL file that he included in the ZIP file, no Manually edit except Overwrite the file and the SQL command.
any other suggestions?
Thank you! :)
@uny
What is Your Coppermine version?
It should be newest version 1.2.1.
I have now modified 6 coppermine galleries to GD" watermarking with out any problem.
I try do that normal_ image size check to this modification on weekend.
@Sammy - the 1.3 release is almost final now - I would suggest whatever you do now onwards should be for version 1.3
@Tarique
Great to hear about 1.3 version!
I will wait for it.
Sammy.. I wanna thank ya again.. your watermarking is working just great for me :):)
Quote from: "photoman13"Sammy.. I wanna thank ya again.. your watermarking is working just great for me :):)
You're welcome!
Nice to here that it's working fine for You.
Sammy,
Does this hack also work for version 1.3.0? did you allready test that?
Regards,
K.D.
@kudde6
I dont know if it will work. I dont have 1.3 yet :(
Last time when I was trying to find 1.3, it was still available for those testers only. Now it seems to be available on public for a month ? :oops: :oops: :oops:
I'll try it.....
HI Sammy,
Any chance that you have tested it ?
Regards,
Kudde6
why don't you test it for the community and let us know your test results ;)
GauGau
this was a great mod I would said.
There is something I would suggest the author of this hack or some one familiar with this hack to think into. When ever the watermark is applied the exif information in the JPEG somehow got delete. I don't know if it possible that the image to have the Exif and still have the watermark on them.
Thanks for this great mod.
Quote from: Tarique Sani on March 26, 2004, 11:14:03 AM
Can you zip up the relevant files and post a link OR sent it to me
I will incorporate it into the main CPG (of course your name will be in the credits)
Do you guys plan on putting it into CPG 1.3 standard?
Would love to see that.
Permanent Watermark with GD2
+ CPG 1.3
= my Dream CPG
Great mod Sammy:
Does anyone have this active so that I may see the albums with the watermark?
Read through all posts first :D
Sammy's site:
http://www.jarnokalliomaki.com/index_carry.shtml
Quote from: hoggwild on April 30, 2004, 04:55:08 PM
Great mod Sammy:
Does anyone have this active so that I may see the albums with the watermark?
It's active on 2 of my sites :)
http://www.ericjon.com/photoserver
&
http://www.richiebrown.net/gallery
I decided to "modify" this mod so it'll work in CPG 1.3 and my brother helped me fix the "_normal" bug
Permanent Watermark with GD2 MOD
For CPG users who wants to add GD2 watermark function on their gallery.
This MOD uses GD2!
Here is how to mod CPG 1.3 to be able to add watermark automatically on new pics and by choise on all pics in selected album.
This is quite long post, but it takes only about 10 minutes to add this mod
Files that needs to be modified:
Lang/english.php
include/picmgmt.inc.php
util.php
config.php
(and 4 SQL command to execute)
REMEMBER to take backup from all files that You are modifying
1.
Open file Lang/english.php
Find this:'th_wd' => 'Width',
Add this after it
'wm_bottomright' => 'Bottom right',
'wm_bottomleft' => 'Bottom left',
'wm_topleftt' => 'Up left',
'wm_topright' => 'Up Right',
'wm_both' => 'Both',
'wm_original' => 'Original',
'wm_resized' => 'Resized',
Find this:
array('Display notices in debug mode', 'debug_notice', 1), //cpg1.3.0
Add this after it
'Image watermarking',
array('Watermark Image on upload', 'enable_watermark', 1),
array('Where to place the watermark', 'where_put_watermark', 11),
array('which files to watermark', 'which_files_to_watermark', 12),
array('Which file to use for watermark', 'watermark_file', 0),
Find this: 'delete_orphans' => 'Delete orphaned comments (works on all albums)',
Add this a line after it
'watermarks' => 'Add watermaks',
'watermark_normal' => 'Resized images only',
'watermark_image' => 'Original sized only',
'watermark_both' => 'Original and resized images',
'watermark_wait' => 'Watermarking images...',
'watermark_continue_wait' => 'Continuing to watermarking originals and/or resized images...',
2.
Open file include/picmgmt.inc.php
Find this:$image_filesize = filesize($image);
Add this before it
//Adds watermarks to new images
if ($CONFIG['enable_watermark'] == '1' && $CONFIG['which_files_to_watermark'] == 'both' || $CONFIG['which_files_to_watermark'] == 'original') {
if (!watermark($image)) //this is for full size image
return false;
}
if ($CONFIG['enable_watermark'] == '1' && $CONFIG['which_files_to_watermark'] == 'both' || $CONFIG['which_files_to_watermark'] == 'resized') {
if (file_exists($normal) && !watermark($normal)) //this is for intermediate size image
return false;
}
The following line has been modified to fix the the "_normal bug"
if (file_exists($normal) && !watermark($normal)) //this is for intermediate size image
Find this:?>
(or end of picmgmt.inc.php)
Add this before it
/**
* watermark_image()
*
* Create a file containing a watermarked image
*
* @param $src_file the source file
* @param $dest_file the destination file
* @param $new_size the size of the square within which the new image must fit
* @param $method the method used for image resizing //ainoastaan gd2
* @return 'true' in case of success
*/
function watermark($src_file)
{
global $CONFIG, $ERROR;
global $lang_errors;
$imginfo = getimagesize($src_file);
if ($imginfo == null)
return false;
// GD can only handle JPG & PNG images
if ($imginfo[2] != GIS_JPG && $imginfo[2] != GIS_PNG) {
$ERROR = $lang_errors['gd_file_type_err'];
return false;
}
// height/width
$srcWidth = $imginfo[0];
$srcHeight = $imginfo[1];
/* if ($thumb_use == 'ht') {
$ratio = $srcHeight / $new_size;
} elseif ($thumb_use == 'wd') {
$ratio = $srcWidth / $new_size;
} else {
$ratio = max($srcWidth, $srcHeight) / $new_size;
}
$ratio = max($ratio, 1.0);*/
$destWidth = $srcWidth; //(int)($srcWidth / $ratio);
$destHeight = $srcHeight; //(int)($srcHeight / $ratio);
$dest_file = $src_file;
// Method for thumbnails creation
// switch ($method) {
// case "gd2" :
if (!function_exists('imagecreatefromjpeg')) {
cpg_die(CRITICAL_ERROR, 'PHP running on your server does not support the GD image library, check with your webhost if ImageMagick is installed', __FILE__, __LINE__);
}
if (!function_exists('imagecreatetruecolor')) {
cpg_die(CRITICAL_ERROR, 'PHP running on your server does not support GD version 2.x, please switch to GD version 1.x on the config page', __FILE__, __LINE__);
}
if ($imginfo[2] == GIS_JPG)
$src_img = imagecreatefromjpeg($src_file);
else
$src_img = imagecreatefrompng($src_file);
if (!$src_img) {
$ERROR = $lang_errors['invalid_image'];
return false;
} //duunataan wesileima
$dst_img = imagecreatetruecolor($destWidth, $destHeight);
/*$dst_img =*/ ImageAlphaBlending($dst_img, true) or die ("Could not alpha blend"); // Enable when on GD 2+
imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $destWidth, (int)$destHeight, $srcWidth, $srcHeight);
$logoImage = ImageCreateFromPNG($CONFIG['watermark_file']);
$logoW = ImageSX($logoImage);
$logoH = ImageSY($logoImage);
//where is the watermark displayed...
$pos = $CONFIG['where_put_watermark'];
if ($pos == "topleft") {
$src_x = 5;
$src_y = 5;
} else if ($pos == "topright") {
$src_x = $srcWidth - ($logoW + 5);
$src_y = 5;
} else if ($pos == "bottomleft") {
$src_x = 5;
$src_y = $srcHeight - ($logoH + 5);
} else if ($pos == "bottomright") {
$src_x = $srcWidth - ($logoW + 5);
$src_y = $srcHeight - ($logoH + 5);
}
ImageCopy($dst_img,$logoImage,$src_x,$src_y,0,0,$logoW,$logoH); //$dst_x,$dst_y,0,0,$logoW,$logoH);
imagejpeg($dst_img, $src_file, $CONFIG['jpeg_qual']);
imagedestroy($src_img);
imagedestroy($dst_img);
// break;
//}
// Set mode of uploaded picture
// We check that the image is valid
$imginfo = getimagesize($src_file);
if ($imginfo == null) {
$ERROR = $lang_errors['resize_failed'];
@unlink($src_file);
return false;
} else {
return true;
}
}
3.
Open File util.php
Find this: function deleteorig()
Add this before it
function vesileimaathumbit() //watermarkthumbs
{
global $picturetbl, $CONFIG, $lang_util_php;
$phpself = $_SERVER['PHP_SELF'];
$albumid = $_POST['albumid'];
$updatetype = $_POST['updatetype'];
$numpics = $_POST['numpics'];
$startpic = 0;
$startpic = $_POST['startpic'];
$query = "SELECT * FROM $picturetbl WHERE aid = '$albumid'";
$result = MYSQL_QUERY($query);
$totalpics = mysql_numrows($result);
if ($startpic == 0) {
// 0 - numpics
$num = $totalpics;
// Over picture limit
if ($totalpics > $numpics) $num = $startpic + $numpics;
} else {
// startpic - numpics
$num = $startpic + $numpics;
if ($num > $totalpics) $num = $totalpics;
}
$i = $startpic;
while ($i < $num) {
$image = $CONFIG['fullpath'] . mysql_result($result, $i, "filepath") . mysql_result($result, $i, "filename");
if ($updatetype == 0 || $updatetype == 2) {
$imagesize = getimagesize($image);
if (max($imagesize[0], $imagesize[1]) > $CONFIG['picture_width'] && $CONFIG['make_intermediate']) {
$image = $CONFIG['fullpath'] . mysql_result($result, $i, "filepath") . $CONFIG['normal_pfx'] . mysql_result($result, $i, "filename");
} else {
$image = $CONFIG['fullpath'] . mysql_result($result, $i, "filepath") . mysql_result($result, $i, "filename");
}
if (watermark($image)) {
print $image .' '. $lang_util_php['updated_succesfully'] . '!<br />'; //$normal .' '. $lang_util_php['updated_succesfully'] . '!<br />';
my_flush();
} else {
print $lang_util_php['error_create'] . ':$image<br />'; //$lang_util_php['error_create'] . ':$normal<br />';
my_flush();
}
}
if ($updatetype == 1 || $updatetype == 2) {
$image = $CONFIG['fullpath'] . mysql_result($result, $i, "filepath") . mysql_result($result, $i, "filename");
if (watermark($image)) {
print $image .' '. $lang_util_php['updated_succesfully'] . '!<br />'; //$normal .' '. $lang_util_php['updated_succesfully'] . '!<br />';
my_flush();
} else {
print $lang_util_php['error_create'] . ':$image<br />'; //$lang_util_php['error_create'] . ':$normal<br />';
my_flush();
}
}
++$i;
}
$startpic = $i;
if ($startpic < $totalpics) {
?>
<form action=<?php echo $phpself;
?> method="post">
<input type="hidden" name="action" value="continuewatermarks" />
<input type="hidden" name="numpics" value="<?php echo $numpics?>" />
<input type="hidden" name="startpic" value="<?php echo $startpic?>" />
<input type="hidden" name="updatetype" value="<?php echo $updatetype?>" />
<input type="hidden" name="albumid" value="<?php echo $albumid?>" />
<input type="submit" value="<?php print $lang_util_php['continue'];
?>" class="submit" /></form>
<?php
}
}
Find this:updatethumbs();
Add this after it
echo '<br /><a href="' . $phpself . '">' . $lang_util_php['back'] . '</a>';
} else if ($action == 'watermarks') {//tämä
global $picturetbl, $CONFIG;
print '<a href="' . $phpself . '">' . $lang_util_php['back'] . '</a><br />';
print '<h2>' . $lang_util_php['watermark_wait'] . '</h2>';
vesileimaathumbit(); //watermarkthumbs
echo '<br /><a href="' . $phpself . '">' . $lang_util_php['back'] . '</a>';
} else if ($action == 'continuewatermarks') {//tämä
print '<a href="' . $phpself . '">' . $lang_util_php['back'] . '</a><br />';
print '<h2>' . $lang_util_php['watermark_wait'] . '</h2>';
vesileimaathumbit(); //watermarkthumbs
Find this:starttable('100%', '<input type="radio" name="action" value="title" id="title" class="nobg"
(only part of that line)
Add this before it
//This is for watermarking
starttable('100%', '<input type="radio" name="action" value="watermarks" id="watermarks" class="nobg" /><label for="watermarks" accesskey="w" class="labelradio">' . $lang_util_php['watermarks'] . '</label> (1)');
print '
<tr><td>
' . $lang_util_php['update_what'] . ' (2):<br />
<input type="radio" name="updatetype" value="0" id="thumb" class="nobg" /><label for="thumb" accesskey="w" class="labelradio">' . $lang_util_php['watermark_normal'] . '</label><br />
<input type="radio" name="updatetype" value="1" id="resized" class="nobg" /><label for="resized" accesskey="r" class="labelradio">' . $lang_util_php['watermark_image'] . '</label><br />
<input type="radio" name="updatetype" value="2" checked="checked" id="all" class="nobg" /><label for="all" accesskey="a" class="labelradio">' . $lang_util_php['watermark_both'] . '</label><br />
' . $lang_util_php['update_number'] . '
<input type="text" name="numpics" value="' . $defpicnum . '" size="5" /><br />
' . $lang_util_php['update_option'] . '<br /><br />
</td></tr>';
endtable();
print '<br />';
4.
Open file config.php
Find this:function create_form(&$data)
Add this above it
// Added for allowing user to select where to add watermarks on pics...
function form_watermark($text, $name)
{
global $CONFIG, $lang_config_php;
$value = $CONFIG[$name];
$bottomright_selected = ($value == 'bottomright') ? 'selected' : '';
$bottomleft_selected = ($value == 'bottomleft') ? 'selected' : '';
$topleftt_selected = ($value == 'topleftt') ? 'selected' : '';
$topright_selected = ($value == 'topright') ? 'selected' : '';
echo <<<EOT
<tr>
<td class="tableb">
$text
</td>
<td class="tableb" valign="top">
<select name="$name" class="listbox">
<option value="bottomright" $bottomright_selected>{$lang_config_php['wm_bottomright']}</option>
<option value="bottomleft" $bottomleft_selected>{$lang_config_php['wm_bottomleft']}</option>
<option value="topleftt" $topleftt_selected>{$lang_config_php['wm_topleftt']}</option>
<option value="topright" $topright_selected>{$lang_config_php['wm_topright']}</option>
</select>
</td>
</tr>
EOT;
}
// Added for allowing user to select which files to watermark...
function form_watermark2($text, $name)
{
global $CONFIG, $lang_config_php;
$value = $CONFIG[$name];
$both_selected = ($value == 'both') ? 'selected' : '';
$original_selected = ($value == 'original') ? 'selected' : '';
$resized_selected = ($value == 'resized') ? 'selected' : '';
echo <<<EOT
<tr>
<td class="tableb">
$text
</td>
<td class="tableb" valign="top">
<select name="$name" class="listbox">
<option value="both" $both_selected>{$lang_config_php['wm_both']}</option>
<option value="original" $original_selected>{$lang_config_php['wm_original']}</option>
<option value="resized" $resized_selected>{$lang_config_php['wm_resized']}</option>
</select>
</td>
</tr>
EOT;
}
Find this: case 10 :
form_number_dropdown($element[0], $element[1]);
break;
Few lines below isdie('Invalid action');
Now we need to paste this
//Watermark place
case 11 :
form_watermark($element[0], $element[1]);
break;
//Which filest to watermark
case 12 :
form_watermark2($element[0], $element[1]);
break;
case 13 :
// do nothing
break;
default:
between them.
After You have done it, it should look like this (I have put couple lines befor and after those lines in this example (hoppe You got it, becouse of My poor english :?
// tabbed display fix
case 10 :
form_number_dropdown($element[0], $element[1]);
break;
//Watermark place
case 11 :
form_watermark($element[0], $element[1]);
break;
//Which filest to watermark
case 12 :
form_watermark2($element[0], $element[1]);
break;
case 13 :
// do nothing
break;
default:
die('Invalid action');
} // switch
} else {
form_label($element);
5.
Then You need to execute theese SQL commands with phpMyAdmin or Webmin, etc.
insert into cpg11d_config (name, value) values ('enable_watermark', '1');
insert into cpg11d_config (name, value) values ('where_put_watermark', 'bottomright');
insert into cpg11d_config (name, value) values ('watermark_file', '/your/full/path/to/logo.png');
insert into cpg11d_config (name, value) values ('which_files_to_watermark', 'both');
Thats it. Now You can go to settings and set it up.
Actually You need to go there, before trying to add new pics.
You have to change 'Which file to use for watermark' to point to your own logo.png file that is used as watermark.
This should contain every modification I have made.
And a zip file with the mod is located at? :D
Great work - thanks
;D Great Job Guys !
I have been busy at my day job for a few weeks now and have'nt done that 1.3 mod yet, so thanks!
Quote from: Tarique Sani on May 06, 2004, 01:20:57 PM
And a zip file with the mod is located at? :D
Great work - thanks
It doesn't look like that'll be happening for a while...
Some strange bug in Windows XP in combination with an ATI Radeon is causing me to be unable to write to my disk... so that has a higher priority right now...
*deep sigh*
I HATE Micro$oft
I have a prob.
I applied the zip'ed files to my coppermine directory and verified that they are correct accoring to your how-to post.
I am getting the follwing error:
QuoteFatal error: Call to undefined function: watermark() in /home/brewcomm/public_html/coppermine/util.php on line 243
anyone have any ideas?
you probably haven't applied the hack properly. Undo your modifications (replace with clean coppermine files) and start from scratch. There's nothing else that can be done...
GauGau
Someone have this working under CPG_Nuke 1.2.2b ?
better check the nuke support board (http://www.nukephotogallery.com/modules.php?name=Forums) for this...
GauGau
hi
when i try to upload the pic this error msg come
The picture 'albums/userpics/10001/041.jpg' can't be inserted in the album
Warning: imagecreatefrompng(http://www.alsaher.net/photo/include/logo.png): failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden in /home/alsaher/public_html/photo/include/picmgmt.inc.php on line 274
Warning: imagesx(): supplied argument is not a valid Image resource in /home/alsaher/public_html/photo/include/picmgmt.inc.php on line 275
Warning: imagesy(): supplied argument is not a valid Image resource in /home/alsaher/public_html/photo/include/picmgmt.inc.php on line 276
Warning: imagecopy(): supplied argument is not a valid Image resource in /home/alsaher/public_html/photo/include/picmgmt.inc.php on line 293
Warning: getimagesize(albums/userpics/10001/normal_041.jpg): failed to open stream: No such file or directory in /home/alsaher/public_html/photo/include/picmgmt.inc.php on line 231
Quote from: Nawaf on March 31, 2004, 07:48:28 AM
Hi,
i tried it but i got this error when i tried to Make the settings from control panel
Watermarking images...
Warning: imagesx(): supplied argument is not a valid Image resource in /home/content/d/o/c/docarabiacom/html/cpg/include/picmgmt.inc.php on line 275
Warning: imagesy(): supplied argument is not a valid Image resource in /home/content/d/o/c/docarabiacom/html/cpg/include/picmgmt.inc.php on line 276
Warning: imagecopy(): supplied argument is not a valid Image resource in /home/content/d/o/c/docarabiacom/html/cpg/include/picmgmt.inc.php on line 293
albums/userpics/infarct.jpg updated succesfully!
Warning: imagesx(): supplied argument is not a valid Image resource in /home/content/d/o/c/docarabiacom/html/cpg/include/picmgmt.inc.php on line 275
Warning: imagesy(): supplied argument is not a valid Image resource in /home/content/d/o/c/docarabiacom/html/cpg/include/picmgmt.inc.php on line 276
Warning: imagecopy(): supplied argument is not a valid Image resource in /home/content/d/o/c/docarabiacom/html/cpg/include/picmgmt.inc.php on line 293
albums/userpics/infarct.jpg updated succesfully!
Warning: imagesx(): supplied argument is not a valid Image resource in /home/content/d/o/c/docarabiacom/html/cpg/include/picmgmt.inc.php on line 275
Warning: imagesy(): supplied argument is not a valid Image resource in /home/content/d/o/c/docarabiacom/html/cpg/include/picmgmt.inc.php on line 276
Warning: imagecopy(): supplied argument is not a valid Image resource in /home/content/d/o/c/docarabiacom/html/cpg/include/picmgmt.inc.php on line 293
albums/userpics/art_normal.jpg updated succesfully!
Warning: imagesx(): supplied argument is not a valid Image resource in /home/content/d/o/c/docarabiacom/html/cpg/include/picmgmt.inc.php on line 275
Warning: imagesy(): supplied argument is not a valid Image resource in /home/content/d/o/c/docarabiacom/html/cpg/include/picmgmt.inc.php on line 276
Warning: imagecopy(): supplied argument is not a valid Image resource in /home/content/d/o/c/docarabiacom/html/cpg/include/picmgmt.inc.php on line 293
albums/userpics/art_normal.jpg updated succesfully!
I had the same problem, and solved it.
The problem was the database. You must make sure the database changes were made, in my case I had installed a second version of coppermine with the table prefix cpg11_
not cpg11d_
Thanks to all, got it working great!!! :P
snork13.net
Got these errors while running Burpee's latest mod after I applied the watermark with util.php (using 1.3.0):
Warning: imagejpeg(): Unable to open 'albums/familymiscbatch1/mamupops1.jpg' for writing in /home/content/t/u/r/turtleboy212/html/foto/foto-gallery/include/picmgmt.inc.php on line 317
albums/familymiscbatch1/mamupops1.jpg updated succesfully!
albums/userpics/puffpuff.jpg updated succesfully!
ERROR creating:$image
It seems to apply it to some and not others. And it returns multiple identical returns when it's finished like this:
albums/userpics/puffpuff.jpg updated succesfully!
albums/userpics/puffpuff.jpg updated succesfully!
heres the files i am using:
http://www.skylinedesigns.net/misc/gd2watermark.rar
i've applied this mod to my 1.3 installation and everything worked perfectly.. excellent mod and thanks to the author..
however i think you should make it more clear for beginners in the instructions regarding the final mysql settings..
in particular:
insert into cpg11d_config (name, value) values ('enable_watermark', '1');
insert into cpg11d_config (name, value) values ('where_put_watermark', 'bottomright');
insert into cpg11d_config (name, value) values ('watermark_file', '/*******/**/*********/htdocs/gallery/watermark.png');
insert into cpg11d_config (name, value) values ('which_files_to_watermark', 'both');
the prefix highlighted in red should be made clearer that the user needs to edit this and make sure it corresponds to their gallery prefix.. ie my gallery prefix is cihgallery_
and the path to the watermark image highlighted in blue should be made clear that this has to be the full directory path and not a URL
experienced users will know this already, but the less experienced may not realise..
regards
Vaughan
First off - I must saw, awesome mod!
Two things:
1) Is it possible to adjust the transparency of the watermark, or is that something that needs to be done with the watermark itself (i.e. use a transparent png file).
2) Has anyone worked on code to center the watermark and place it on the original image and then do resizing, while storing an UNwatermarked image? If so I'd like a peek, if not I'll try and hack away at them and post the code.
Cheers,
~jb
Quote from: khayman on June 22, 2004, 10:33:23 PM
First off - I must saw, awesome mod!
Two things:
1) Is it possible to adjust the transparency of the watermark, or is that something that needs to be done with the watermark itself (i.e. use a transparent png file).
2) Has anyone worked on code to center the watermark and place it on the original image and then do resizing, while storing an UNwatermarked image? If so I'd like a peek, if not I'll try and hack away at them and post the code.
Cheers,
~jb
1) It's in the PNG :D
2) I followed everything you were saying until you said "storing an UNwatermarked image" ... why would you want to watermark it and then store an image w/o watermark?
Anyway, nope, nobody has tried that for afaik... I don't think the code is that hard though, you'd just have to do some math for centering the watermark... if you figure it out, post it here :D
Burpee,
The reason for storing an UNwatermarked original is because of the type of site I want to set up - eventually I want people to be able to order prints from it. If the original and the resized images are watermarked, then I have nothing to make a print off of. I was looking at things and I believe what I will do is just watermark the resized and have that as the main image with no click on for a full size image :) some of them get pretty large!
Thanks for the response!
Wouldn't you want to store the printing formats locally on your computer anyway?
And if you'd really want people to order prints, you should have fairly low res images on your site.
I agree with Burpee: if you keep the hires pics on the server, anybody who knows the naming scheme of coppermine could get the hires pics for free by just entering the url.
GauGau
Cool! Thanks for this MOD. Just installed and it seems to work perfectly (http://damysterious.xs4all.nl/gallery/displayimage.php?album=lastup&cat=&pos=0) hier in all modes 8). I have to change the .png now.
Burpee/GauGau,
Yeah I realized that regarding the image path... going to have to rethink my strategy. One thing I could do is a daily check on when images are uploaded and manually move those images to my local drive. I won't have all the photos initially as some of them will be coming from other people posting their images as well. I figure it's best to get the hi-res versions when the user uploads it instead of having to contact them if/when someone wants to purchase a print.
I need obtain that watermark is added to the photos that I raise with of the batch, they excuse if I am annoying but I am new in this forum and I need do this for my CPG. Thanks
::)
thze mod does what it says, not more. You shouldn't request new features, especially for a mod that was written for an outdated version (cpg1.2.1).
Joachim
Jachim thanks for your answer already I have post again in post of the version 1.3.x
Bye !
Maria
Tnx for the mod, works really great, although i have one problem.
At first i didnt see it was for version 1.2, but i didnt care when i saw it, cause it worked, but now i noticed that my
crop and rotate buttons and edit picture buttons are gone.. Does anyone have a solution ?
tnx in advance
Apply the correct version maybe.
actually i used the zip, and copied the files, and the index.php head said it was the correct version. Didnt anybody else have this problem ?
Hello..
I am using cpgnuke at my homepage and now I wonder if it´s a watermark hack for
cpgnuke or if some one can help me to write the code I need.
I have looked in the forums but the watermark hacks are just for coppermine stand alone version.
Please can some one help me..
I really need that hack
tanx
david
PS
My php is not good
ds
Why don't you ask for help at http://cpgnuke.com? They have forums too.
Or do what we suggest is best, and watermark them on your client before upload, using a free batch watermarking tool like this (http://www.faststoneserver.com/FSResizerDetail.htm)
I'd like to use Burpee's mod of this mod, for CPG 1.3... however I'm wondering where the watermark will appear? and how to set it so that it will appear at bottom - 10px left - 10px (in the bottom left corner with a 10 pixel offset).
I am sorry if this is answered somewhere in this thread allerady.
How exactly does this MOD work:
1) do all the batch uploaded pictures get watermarked?
-- or, do I get to chose if batch uploaded pictures get watermarked?
2) do individual uploaded pictures get water marked?
-- do users/members (as opposed to admin level) have any control over the water marking process in this case.
3) what happens when a user uploads video, mp3, zip, pdf file?
-- does the upload faile?
-- does the file become unreadable?
The reason I am asking this is because I am designing a site that will have a gallery that allows loged-in members to upload there own pictures/videos/documents. I want to have a watermark on the pictures that the users upload. The user should not be able to upload a picture without a water mark (although it is ok if they have a choice where to place the watermark on the picture)
The rest of the galleries are not for uploads by users. For these galleries I do the batch uploading and the pictures are already watermarked on my desktop pc prior to upload.
So, to some it up: all pictures that are uploaded via http/form need to be watermarked.
Batch files should not be watermarked.
Non-picture files should not be a problem (since I do not limit the file type to be uploaded)
I also think that anyone that thinks about using water marking should have these answers before going through the work of installing and testing the MOD's.
Please help, thank's in advance
David, don't post identical replies in two different threads. If you are using 1.2, post here. If you are using 1.3, post in the other thread.
I am getting
Parse error: parse error, unexpected ';' in /usr/home/sirjinx/public_html/RSP/util.php on line 279
This is what is on line 279
?>" class="submit" /></form>
But I am also a noob when it comes to modifications.
For step 2, I didnt understand what you ment by
QuoteActivate all after above code and paste all from below
What do you mean by "activate" ?
(I've attached the files in case you might want too look at it.)
Try changing
?>" class="submit" /></form>
to
?>
" class="submit" /></form>
Quote from: TranzNDance on March 03, 2005, 06:54:23 PM
Try changing
?>" class="submit" /></form>
to
?>
" class="submit" /></form>
ok i've tried
stills says the error on line 279. so problem has to be coming from ?>
but I'm not very good in php. I've tried moving it around. Making it /> or just >
When I opened the file you included in your post, it included lots of extra lines. So line 279 isn't what you posted. You probably have issues elsewhere. I would suggest starting over. Sorry.
I think your problem is in this line:
<input type="submit" value="<?php print $lang_util_php['continue'];
Try this
<input type="submit" value="<?php print $lang_util_php['continue']
When you copy and paste, make sure you are using notepad or something like it. Frontpage and other crappy tools like it will change certain characters to the ascii number, which screws up your code.
That's in util.php. Sorry I didn't mention at the start of this post.
k nvm.
im too much of a noob.
installed the wrong version...
sry :(
i have 1.3.2
and this 1.2.x =/
Is there any easy way to watermark existing photos to match the way the new modification watermarks new uploads?!
I'd like to watermark all of the existing photos in our gallieries to match but dont want to have to re-upload everything and ask our members to do the same. Any advise would be appreciated. I would also like to thank everyone for the informatitive posts, I installed the mod in about eight minutes with no issue whatsoever. Thank you.
Our Gallery:
http://topshelfexotic.com/gallery/
in admin mod, go in util, and select "watermark", and watermark your existing photos in your gallery.
poubao :D
hey all
first i wana thank for this great mod
ive installed it before and had no problems , but now on another gallery im having difficulties
when i wanna upload a new picture , it uploads fine but when i want to assign it to an album , it says Warning: getimagesize(albums/userpics/10001/normal_test.jpg): failed to open stream: No such file or directory in /****/include/picmgmt.inc.php on line 231
Line 231 is - $imginfo = getimagesize($src_file);
Ive modified the picmgmt.inc.php myself and also put the file included in the .zip by sammy , and the same thing ...
The files added before get watermarked , but now i cant even upload new pics , not to mention upload + watermark automatically
What could be the problem ?
And also , if u could help with one question , how to batch the entire gallery , not every album separately , there are 2000+ albums
Hi
what coppermine version You are using?
This mod is for 1.2.1.
1.3 version is available also, You can obtain it from different location.
It's made by BurBee and U can find it in same category as this topic.
Here's link to BurBee's 1.3 version ;)
http://forum.coppermine-gallery.net/index.php?topic=7160.0
well i knew it was made by you and hence ive modified with this one :( and now its *&!^$#*@#*&$#@
do u happen to have 1.3.2 files that are modified ? can u make a zip pls ? :) with the original files so that i can modify them accordingly to 1.3 modifs or if u have a zip with the files already modified like here but for the 1.3
disregard , ive got the original files and modified accordingly to 1.3 and everything is OK now :) tnx again for the mod and for the attention