forum.coppermine-gallery.net
Support => cpg1.5.x Support => cpg1.5 miscellaneous => Topic started by: Marcovw 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
-
Do you want to extend the current search form or do you want to have a separate search form?
-
I wish to extend it, thus adding it at the list of the default searches.
-
Should it be an exact or min/max search? Do you already have some ideas about the front-end design?
-
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/ (http://postimage.org/image/f5ysgee73/)
Awesome M$Paint skills are awesome
-
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.
-
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.
-
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'].')' : '';
-
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.
-
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" />
-
Awesome, if I'd actually spend time thinking about, I could've thought of that "*" myself.
Who da man?
You da man!
-
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.