Searching by size Searching by size
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Searching by size

Started by Marcovw, May 02, 2012, 04:34:46 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Marcovw

Hello there.

I've been looking for it but can't find anything about it. Is it possible to make it so that people can search for images based on file size or image size?

File size = ## MB search
Image size = Height x Width search

Thanks in advance,
Marco

Αndré

Do you want to extend the current search form or do you want to have a separate search form?

Marcovw

I wish to extend it, thus adding it at the list of the default searches.

Αndré

Should it be an exact or min/max search? Do you already have some ideas about the front-end design?

Marcovw

Quote from: Αndré on May 04, 2012, 10:22:06 AM
Should it be an exact or min/max search? Do you already have some ideas about the front-end design?

I just want to keep it simple. Add fields in the "search" area.. I made a screenshot of how I want, most text is in Dutch, but the part I want will be in english. When I have the code to add the function I'm pretty sure I can translate it ^_^

http://postimage.org/image/f5ysgee73/

Awesome M$Paint skills are awesome

Αndré

#5
I still don't get how your file size search is supposed to work. Will the user enter something like 1485395 and then all images with that file size (in Bytes) will be displayed?

Attached is your hot-linked screenshot.

Marcovw

Oh, you wanted to know that. I missunderstood you, my apologies.

Yes, for the file size the user just enter te file size (in Bytes). I know it's pretty odd, but they want it like that.

Αndré

Open thumbnails.php, find
$allowed = array('title', 'caption', 'keywords', 'filename', 'pic_raw_ip', 'pic_hdr_ip', 'user1', 'user2', 'user3', 'user4', 'type', 'owner_name');
or
$allowed = array('title', 'caption', 'keywords', 'filename', 'pic_raw_ip', 'pic_hdr_ip', 'user1', 'user2', 'user3', 'user4', 'type', 'owner_name', 'newer_than', 'older_than');
(depending on which version you currently use)
and replace with
$allowed = array('title', 'caption', 'keywords', 'filename', 'pic_raw_ip', 'pic_hdr_ip', 'user1', 'user2', 'user3', 'user4', 'type', 'owner_name', 'newer_than', 'older_than', 'filesize', 'pwidth', 'pheight');


open search.php, find
$owner_name
$customs
$ip

and above, add
                                        <tr>
                                                <td align="right" colspan="2">File size <input type="text" name="filesize" size="6" class="textinput" /> Byte</td>
                                        </tr>
                                        <tr>
                                                <td align="right" colspan="2">Picture width <input type="text" name="pwidth" size="6" class="textinput" /> Pixel</td>
                                        </tr>
                                        <tr>
                                                <td align="right" colspan="2">Picture height <input type="text" name="pheight" size="6" class="textinput" /> Pixel</td>
                                        </tr>



open include/search.inc.php, find
$sql .=  " AND approved = 'YES' $FORBIDDEN_SET";
and above, add
        $sql .= Inspekt::isInt($USER['search']['params']['filesize']) ? ' AND ( filesize = '.$USER['search']['params']['filesize'].')' : '';
        $sql .= Inspekt::isInt($USER['search']['params']['pwidth']) ? ' AND ( pwidth = '.$USER['search']['params']['pwidth'].')' : '';
        $sql .= Inspekt::isInt($USER['search']['params']['pheight']) ? ' AND ( pheight = '.$USER['search']['params']['pheight'].')' : '';

Marcovw

Sorry I did not reply earlier, didn't had time to focus on Coppermine because of another project.

Anyhow, the searching by size works, but with a small flaw. I tested it, by trying to search by different sizes, but didnt get any hits, until I added a letter in the search box wich was also present in a image, then I get some results by size.

What I want is just to insert the values of hight, width or filesize, withouth having to input something in the search box.

Αndré

Open search.php, find
<input type="text" style="width: 80%" name="search" maxlength="255" value="" class="textinput" />
and replace with
<input type="text" style="width: 80%" name="search" maxlength="255" value="*" class="textinput" />

Marcovw

Awesome, if I'd actually spend time thinking about, I could've thought of that "*" myself.

Who da man?

You da man!

Αndré

Please
Quote from: Joachim Müller on September 28, 2008, 12:46:26 PM
tag your answer as "solved" by clicking on the "Topic Solved" button on the bar at the left hand side at the bottom of your thread.