Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1] 2 3 4 5 6   Go Down

Author Topic: Permanent Watermark with GD2  (Read 110445 times)

0 Members and 1 Guest are viewing this topic.

Sammy

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 27
Permanent Watermark with GD2
« on: March 05, 2004, 07:53:14 pm »

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):
Code: [Select]
        'select_album' => 'Select album',Paste theese lines:
Code: [Select]
        '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 ?)
Code: [Select]
            // 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
Code: [Select]
        /**
         * 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
« Last Edit: October 22, 2004, 08:31:23 am by GauGau »
Logged

Sammy

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 27
Permanent Watermark with GD2
« Reply #1 on: March 05, 2004, 08:58:08 pm »

OK, Pizza is destroyed now.

3. util.php
Find line
Code: [Select]
function deleteorig()
Near line 206

Add new line Above text "function deleteorig()"
and paste code from below

Code: [Select]
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'&#93;;
        
?>
" class="submit" /></form>
                    <?php
    
&#125;
&#125;


Between lines
Code: [Select]
updatethumbs(); (last one, near line 358)
and
Code: [Select]
filenametotitle(0); (should be only few lines after "updatethumbs();" )

Paste this code
Code: [Select]

    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 this
Code: [Select]
print '<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
Code: [Select]
   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 :?
Logged

Ravage

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
Permanent Watermark with GD2
« Reply #2 on: March 06, 2004, 12:32:52 am »

Great job! Will try it out later.
Logged

Zcaithaca

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
    • http://www.graphikdezignz.com
Permanent Watermark with GD2
« Reply #3 on: March 18, 2004, 03:36:19 am »

srry if this is a newbie question but where is the resize image thing located?
Logged

Sammy

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 27
Resize image
« Reply #4 on: March 18, 2004, 08:17:20 am »

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://forum.coppermine-gallery.net/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.
Logged

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Permanent Watermark with GD2
« Reply #5 on: March 18, 2004, 12:37:49 pm »

Addition to above, the link is not shown in the hardwired theme.
Logged
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

Zcaithaca

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
    • http://www.graphikdezignz.com
Permanent Watermark with GD2
« Reply #6 on: March 18, 2004, 10:48:05 pm »

ok thx im using the hardwired so ill change it
Logged

photoman13

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 96
Permanent Watermark with GD2
« Reply #7 on: March 20, 2004, 05:51:21 am »

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 :)
Logged

Sammy

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 27
Sample gallery
« Reply #8 on: March 23, 2004, 11:13:06 am »

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
Logged

Sammy

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 27
GD2 watermarking
« Reply #9 on: March 23, 2004, 11:31:16 am »

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 .
Logged

Tarique Sani

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 2712
    • http://tariquesani.net
Permanent Watermark with GD2
« Reply #10 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)
Logged
SANIsoft PHP applications for E Biz

Sammy

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 27
GD2 watermarking files in ZIP
« Reply #11 on: March 26, 2004, 12:10:22 pm »

Hello Tarique

Here is link to zip
Permanent Watermark with GD2

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.
Logged

Tarique Sani

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 2712
    • http://tariquesani.net
Permanent Watermark with GD2
« Reply #12 on: March 26, 2004, 12:52:00 pm »

Thanks - I have got the file, will look into the code and incorporate accordingly
Logged
SANIsoft PHP applications for E Biz

photoman13

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 96
Permanent Watermark with GD2
« Reply #13 on: March 26, 2004, 09:02:32 pm »

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 :)
Logged

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Permanent Watermark with GD2
« Reply #14 on: March 26, 2004, 09:11:41 pm »

@photoman,

you don't have to change theme, just type in the url direct, i.e., yoursite.com/gallery/util.php
Logged
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

Sammy

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 27
Permanent Watermark with GD2
« Reply #15 on: March 26, 2004, 10:08:00 pm »

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.
Logged

photoman13

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 96
Permanent Watermark with GD2
« Reply #16 on: March 26, 2004, 10:26:57 pm »

thanks Sammy :)

I'll just do it that way til you get that process complete :)

it's still a great addition :)
Logged

Sammy

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 27
Now it also add watermarks, when adding new images!!!
« Reply #17 on: March 26, 2004, 11:27:30 pm »

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.


1
You need to add all modifications mentioned on this topics 1st and 2nd post.

2
Open Your modified /include/picmgmt.inc.php and find line 34. It should look like this:
Code: [Select]
               return false;

3
Add theese new lines after line 34
Code: [Select]


                //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:.
Code: [Select]
<?php 
// ------------------------------------------------------------------------- //
// Coppermine Photo Gallery 1.2.1                                            //
// ------------------------------------------------------------------------- //
// Copyright &#40;C&#41; 2002,2003 Gregory DEMAR                                     //
// http&#58;//www.chezgreg.net/coppermine/                                       //
// ------------------------------------------------------------------------- //
// Updated by the Coppermine Dev Team                                        //
// &#40;http&#58;//coppermine.sf.net/team/&#41;                                          //
// 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         //
// &#40;at your option&#41; any later version.                                       //
// ------------------------------------------------------------------------- //
// Add a picture to an album
function add_picture&#40;$aid, $filepath, $filename, $title = '', $caption = '', $keywords = '', $user1 = '', $user2 = '', $user3 = '', $user4 = '', $category = 0, $raw_ip = '', $hdr_ip = ''&#41;
&#123;
    
global $CONFIG$ERROR$USER_DATA$PIC_NEED_APPROVAL;
    global 
$lang_errors;

    
$image $CONFIG['fullpath'&#93; . $filepath . $filename;
    
$normal $CONFIG['fullpath'&#93; . $filepath . $CONFIG['normal_pfx'&#93; . $filename;
    
$thumb $CONFIG['fullpath'&#93; . $filepath . $CONFIG['thumb_pfx'&#93; . $filename;

    
$imagesize getimagesize&#40;$image&#41;;
    
if &#40;!file_exists&#40;$thumb&#41;&#41;
        
if &#40;!resize_image&#40;$image, $thumb, $CONFIG['thumb_width'&#93;, $CONFIG['thumb_method'&#93;, $CONFIG['thumb_use'&#93;&#41;&#41;
            
return false;

        if &
#40;max&#40;$imagesize[0&#93;, $imagesize[1&#93;&#41; > $CONFIG['picture_width'&#93; && $CONFIG['make_intermediate'&#93; && !file_exists&#40;$normal&#41;&#41;
            
if &#40;!resize_image&#40;$image, $normal, $CONFIG['picture_width'&#93;, $CONFIG['thumb_method'&#93;, $CONFIG['thumb_use'&#93;&#41;&#41;
                
return false;

                
//Adds watermarks to new images
        
if &#40;!watermark&#40;$image&#41;&#41;  //this is for full size image
            
return false;
        if &
#40;!watermark&#40;$normal&#41;&#41;  //this is for intermediate size image
            
return false;

            
$image_filesize filesize&#40;$image&#41;;



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
Logged

photoman13

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 96
Permanent Watermark with GD2
« Reply #18 on: March 27, 2004, 12:01:19 am »

Hey Sammy :)

good work :)

I'm gonna go test that myself right now :)

I'll let ya know :)
Logged

photoman13

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 96
Permanent Watermark with GD2
« Reply #19 on: March 27, 2004, 12:05:15 am »

awesome Sammy.. it works for me :)

Thanks again for this great mod!!! :)
Logged
Pages: [1] 2 3 4 5 6   Go Up
 

Page created in 0.032 seconds with 19 queries.