Advanced search  

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]

Pages: [1]   Go Down

Author Topic: Searching by size  (Read 3397 times)

0 Members and 1 Guest are viewing this topic.

Marcovw

  • Coppermine newbie
  • Offline Offline
  • Posts: 6
Searching by size
« on: May 02, 2012, 04:34:46 pm »

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
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15765
Re: Searching by size
« Reply #1 on: May 02, 2012, 07:12:24 pm »

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

Marcovw

  • Coppermine newbie
  • Offline Offline
  • Posts: 6
Re: Searching by size
« Reply #2 on: May 04, 2012, 08:40:57 am »

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

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15765
Re: Searching by size
« Reply #3 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?
Logged

Marcovw

  • Coppermine newbie
  • Offline Offline
  • Posts: 6
Re: Re: Searching by size
« Reply #4 on: May 08, 2012, 09:10:25 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
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15765
Re: Searching by size
« Reply #5 on: May 08, 2012, 11:50:41 am »

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.
« Last Edit: May 08, 2012, 11:56:29 am by Αndré »
Logged

Marcovw

  • Coppermine newbie
  • Offline Offline
  • Posts: 6
Re: Searching by size
« Reply #6 on: May 15, 2012, 09:32:46 am »

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

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15765
Re: Searching by size
« Reply #7 on: May 15, 2012, 11:42:07 am »

Open thumbnails.php, find
Code: [Select]
$allowed = array('title', 'caption', 'keywords', 'filename', 'pic_raw_ip', 'pic_hdr_ip', 'user1', 'user2', 'user3', 'user4', 'type', 'owner_name');or
Code: [Select]
$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
Code: [Select]
$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
Code: [Select]
$owner_name
$customs
$ip
and above, add
Code: [Select]
                                        <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
Code: [Select]
$sql .=  " AND approved = 'YES' $FORBIDDEN_SET";and above, add
Code: [Select]
        $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'].')' : '';
Logged

Marcovw

  • Coppermine newbie
  • Offline Offline
  • Posts: 6
Re: Searching by size
« Reply #8 on: June 05, 2012, 03:45:35 pm »

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

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15765
Re: Searching by size
« Reply #9 on: June 05, 2012, 03:51:27 pm »

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

Marcovw

  • Coppermine newbie
  • Offline Offline
  • Posts: 6
Re: Searching by size
« Reply #10 on: June 05, 2012, 04:29:35 pm »

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

Who da man?

You da man!
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15765
Re: Searching by size
« Reply #11 on: June 05, 2012, 04:55:40 pm »

Please
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.
Logged
Pages: [1]   Go Up
 

Page created in 0.061 seconds with 19 queries.