[del] Delete all code relating to the image-based search.

It's always been disabled, needing a third-party CBIR server that was
never publically available, and there aren't any viable F/OSS CBIR
servers out there.

....We can re-visit this one day.  Until then, bye-bye!
This commit is contained in:
Solomon Peachy 2008-10-02 15:05:22 -04:00
parent 1116950411
commit 2b7715db11
53 changed files with 3 additions and 2150 deletions

View File

@ -22,7 +22,9 @@ For further information about Photo Organizer, see its web site at:
[misc] Add generic functions for "run a simple query and cache it"
[misc] Simplify the photo/version id sanity checks.
[misc] theme_display_photo() doesn't take image size any more.
[misc] Ckean up the rating code on the main photo page.
[misc] Clean up the rating code on the main photo page.
[misc] Move to pg_fetch_all() where possible.
[del] Delete all image-based searching code. Will return one day.
2.36.1 (Under development)

View File

@ -1,106 +0,0 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2008 Solomon Peachy (pizza@shaftnet.org)
// 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 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
include_once "include/config.php";
include_once "include/tools.php";
include_once "include/mime.php";
;
include_once "include/common.php";
include_once "include/site.php";
$select_folder = pg_escape_string($_REQUEST['select_folder']);
$select_album = pg_escape_string($_REQUEST['select_album']);
$selection = $_REQUEST['selection'];
$database = site_prolog(PO_USER_TYPE_USER);
if (!$selection) {
site_push_error($strings['errors_invalid_operation']);
site_epilog($database);
header("Location: my.tools.php?selector=".$tools_data['content_indexer']['idx']);
}
$type = $_REQUEST['type'];
switch ($type) {
case "layout":
$index_algorithm = "ar_index_haar:0.2.0";
break;
case "color":
$index_algorithm = "ar_index_histogram:0.1.0";
}
site_header($strings['generic_content_indexer']);
site_navigator(10);
site_navigator_status(emit_a(generate_link('user', ''), $strings['generic_users'])." : ".$strings['generic_content_indexer'], "");
theme_display_navigator_box_top($tools_data['content_indexer']['idx'], $tools_data, "100%");
if ($po_user['type'] != PO_USER_TYPE_ADMIN) {
$user_sel = " and users = $po_user[id]";
} else {
$user_sel = "";
}
switch ($selection) {
case 'folder':
if ($select_folder == "all")
$sql_selector = " users = $po_user[id] ";
else
$sql_selector = " folder = $select_folder $user_sel";
break;
case 'album':
$sql_selector = " identifier in( select photo from album_content where album = $select_album) $user_sel";
break;
case 'spool':
$sql_selector = " identifier in( select photo from album_content where album = $po_user[spool_album]) $user_sel";
break;
default:
header("Location: my.tools.php?selector=5");
exit();
break;
}
$all_photos = pg_query($database, "
select identifier from photo
where $sql_selector
and access_rights = $access[public]");
$num_of_updates = pg_num_rows($all_photos);
for ($i=0; $i < $num_of_updates; $i++) {
$photo = pg_fetch_row($all_photos, $i);
submit_photo($database, $photo[0], $index_algorithm);
}
print "<p align=\"left\">".$strings['tools_num_photos_indexed']." : $num_of_updates</p>";
print "<p>";
print $thm_elem['button.back'];
print "</p>";
theme_display_navigator_box_bottom("100%");
site_footer($database);
site_epilog($database);
?>

View File

@ -275,18 +275,12 @@ function display_first_day_combo($identifier, $current_value) {
function display_search_engine_type_combo($identifier, $current_value) {
global $strings;
global $cbir_host;
global $cbir_port;
print "<select name=\"$identifier\">";
print emit_option("1", $strings['search_gen_text'], $current_value == 1);
print emit_option("2", $strings['search_adv_text'], $current_value == 2);
print emit_option("3", $strings['search_folders'], $current_value == 3);
print emit_option("4", $strings['search_users'], $current_value == 4);
if ($cbir_host != "" && $cbir_port != "") {
print emit_option("4", $strings['search_img_layout'], $current_value == 3);
print emit_option("5", $strings['search_img_color'], $current_value == 4);
}
print "</select>";
}

View File

@ -54,10 +54,6 @@ $db_dsn = "dbname=po_db user=po_user password=po_password";
/* End Database details */
// content based image retrieval server connection details:
$cbir_host = "";
$cbir_port = "";
// Use output compression?
$compress_pages = true;

View File

@ -1,620 +0,0 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2008 Solomon Peachy (pizza@shaftnet.org)
// 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 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
include_once "include/config.php";
$algorithm_list = array();
$algorithm_counter = 0;
function createXMPFile() {
global $sys_convert;
/* build color palette */
$width = $_REQUEST['width'];
$height = $_REQUEST['height'];
$num_of_colors = 0;
$color_palette = array();
for ($j = 0; $j < $height; $j++) {
for ($i = 0; $i < $width; $i++) {
$index = $j * $width + $i;
$key = str_pad($_REQUEST['px'.$index], 6, "0", STR_PAD_LEFT);
$found = false;
for ($iterator = 0; $iterator < $num_of_colors; $iterator++)
if ($color_palette[$iterator] == $key) {
$found = true;
break;
}
if (!$found) {
$color_palette[$num_of_colors] = $key;
$num_of_colors++;
}
}
}
/* build the XPM file */
$file_body = "/* XPM */\n";
$file_body = $file_body . "static char *image-up[] = {\n";
$file_body = $file_body . "/* width height num_of_colors chars_per_pixel */\n";
$file_body = $file_body . "\" $width $height $num_of_colors 2\",\n";
$file_body = $file_body . "/* colors */\n";
for ($c = 0; $c < $num_of_colors; $c++) {
$file_body = $file_body . "\"".str_pad($c, 2, "0", STR_PAD_LEFT)." c #".$color_palette[$c]."\",\n";
}
$file_body = $file_body . "/* pixels */\n";
for ($j = 0; $j < $height; $j++) {
$file_body = $file_body . "\"";
for ($i = 0; $i < $width; $i++) {
$index = $j * $width + $i;
$key = str_pad($_REQUEST['px'.$index], 6, "0", STR_PAD_LEFT);
for ($c = 0; $c < $num_of_colors; $c++) {
if ($key == $color_palette[$c])
$file_body = $file_body . str_pad($c, 2, "0", STR_PAD_LEFT);
}
}
if ($j == ($height - 1))
$file_body = $file_body . "\"\n};\n";
else
$file_body = $file_body . "\",\n";
}
/* write the temporary file */
$temp_file_name = tempnam($temporary_directory, "po.layout.search");
$fd = fopen($temp_file_name, "w+");
fwrite($fd, $file_body);
fclose($fd);
$temp_file_name_xmp = $temp_file_name . ".xpm";
$temp_file_name_png = $temp_file_name . ".png";
rename($temp_file_name, $temp_file_name_xmp);
system("$sys_convert $temp_file_name_xmp $temp_file_name_png", $retval_convert);
unlink($temp_file_name_xmp);
return $temp_file_name_png;
}
function display_xml($xml_code) {
$xml_code = ereg_replace("<", "&lt;", $xml_code);
$xml_code = ereg_replace(">", "&gt;", $xml_code);
$xml_code = ereg_replace("\"", "&quot;", $xml_code);
$xml_code = ereg_replace("\n", "<br/>\n", $xml_code);
print $xml_code;
}
function startElement($parser, $name, $attribs) {
global $photo_id_list;
global $photo_id_counter;
switch ($name) {
case "QUERY":
break;
case "ALGORITHM":
if (sizeof($attribs)) {
while (list($attribute, $value) = each($attribs)) {
switch ($attribute) {
case "NAME":
$current_folder = $value;
break;
case "VERSION":
$current_folder = $value;
break;
case "REPLY":
$current_folder = $value;
break;
}
}
}
break;
case "MEDIA":
$image_data['folder'] = $current_folder;
if (sizeof($attribs)) {
while (list($attribute, $value) = each($attribs)) {
switch ($attribute) {
case "ID":
$photo_id_list[$photo_id_counter] = "$value";
$photo_id_counter++;
break;
case "SRC":
$image_data['src'] = "$value";
break;
case "SIMILARITY":
$image_data['similarity'] = $value;
break;
case "REPLY":
$image_data['reply'] = $value;
break;
case "TIME":
$image_data['time'] = $value;
break;
}
}
}
break;
}
}
function endElement($parser, $name) {
}
function argon_query($identifier, $cbir_host, $cbir_port,
$index_algorithm, $search_algorithm, $type,
$limit, $offset,
$photo_id, $photo_path) {
$verbose = TRUE;
if (!$cbir_host || !$cbir_port || !$photo_path)
return;
$socket = socket_create (AF_INET, SOCK_STREAM, 0);
if ($socket == FALSE) {
echo "socket_create() failed: reason: " . socket_strerror ($socket) . "<br/>\n";
return;
}
$result = socket_connect ($socket, $cbir_host, $cbir_port);
if ($result == FALSE) {
echo "socket_connect() failed.<br/>\nReason: ($result) " . socket_strerror($result) . "<br/>\n";
return;
}
$index_algorithm_string = substr($index_algorithm, 0, strrpos($index_algorithm, ":"));
$index_algorithm_version = substr($index_algorithm, strrpos($index_algorithm, ":") + 1);
$search_algorithm_string = substr($search_algorithm, 0, strrpos($search_algorithm, ":"));
$search_algorithm_version = substr($search_algorithm, strrpos($search_algorithm, ":") + 1);
$submit = create_query_header($identifier, $type);
$submit = $submit . create_index_algorithm_header($index_algorithm_string, $index_algorithm_version);
$submit = $submit . create_search_algorithm_header($search_algorithm_string, $search_algorithm_version, $limit, $offset);
$submit = $submit . create_body($photo_id, $photo_path);
$submit = $submit . create_search_algorithm_footer();
$submit = $submit . create_index_algorithm_footer();
$submit = $submit . create_query_footer();
socket_write ($socket, $submit, strlen($submit));
if ($verbose) {
print "<h2>Request</h2>";
print "<p><code>\n";
display_xml($submit);
print "</code></p>\n";
}
$xml_parser = xml_parser_create();
xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, TRUE);
xml_set_element_handler($xml_parser, "startElement", "endElement");
if ($verbose) {
print "<h2>Reply</h2>";
print "<p><code>\n";
}
error_reporting(0);
do {
if (FALSE === ($out = socket_read ($socket, 2048, PHP_NORMAL_READ))) {
break;
}
if (!xml_parse($xml_parser, $out)) {
print "<font color=\"red\">XML ERROR -";
print " error code:" . xml_get_error_code($xml_parser);
print " error string:" . xml_error_string(xml_get_error_code($xml_parser));
print " error line:" . xml_get_current_line_number($xml_parser);
print "</font>\n</p>\n";
print "<p>";
display_xml($out);
print "</p>\n";
xml_parser_free($xml_parser);
xml_parser_free($xml_parser);
socket_close($socket);
error_reporting(1);
exit;
}
if ($verbose) {
display_xml($out);
}
} while (true);
if ($verbose) {
print"</code></p>\n";
}
xml_parser_free($xml_parser);
socket_close($socket);
error_reporting(1);
}
function display_effective_content_search($photo_id) {
global $thm_elem;
global $cbir_host;
global $cbir_port;
if (($cbir_host == "") || ($cbir_port == ""))
return FALSE;
print "<form method=\"post\" action=\"search.image.php\" accept-charset=\"".$strings['formats_encoding']."\">\n";
print "<table class=\"search_form\"><tr><td align=\"left\" valign=\"middle\">";
print $thm_elem['button.search'];
print "</td><td align=\"left\" valign=\"middle\">";
print "<input type=\"hidden\" name=\"photo_id\" value=\"$photo_id\" />\n";
print "<select name=\"type\">";
print emit_option("layout", "for photos with similar layout", FALSE);
print emit_option("color", "for photos with similar colors", FALSE);
print "</select>";
print "</td></tr></table>";
print "</form>\n";
}
function display_content_submit($type) {
global $theme;
global $cbir_host;
global $cbir_port;
if (($cbir_host == "") || ($cbir_port == ""))
return FALSE;
print "<table>\n<tr>\n<td align=\"left\" valign=\"middle\" >\n";
print "<select name=\"".$type."\">";
print emit_option("layout", "Index image layout", FALSE);
print emit_option("color", "Index image colors", FALSE);
print "</select>";
print "</td>\n</tr>\n</table>\n";
}
function submit_photo($database, $photo_id, $index_algorithm) {
global $site_url;
global $cbir_host;
global $cbir_port;
$session_id = session_id();
$verbose = TRUE;
if (($cbir_host == "") || ($cbir_port == ""))
return FALSE;
error_reporting(0);
$socket = socket_create (AF_INET, SOCK_STREAM, 0);
if ($socket == FALSE) {
error_reporting(1);
return FALSE;
}
$result = socket_connect ($socket, $cbir_host, $cbir_port);
if ($result == FALSE) {
error_reporting(1);
return FALSE;
}
$index_algorithm_string = substr($index_algorithm, 0, strrpos($index_algorithm, ":"));
$index_algorithm_version = substr($index_algorithm, strrpos($index_algorithm, ":") + 1);
$submit = "<?xml version=\"1.0\" standalone=\"yes\" ?>\n";
$submit = $submit . "<submit id=\"$session_id\">\n";
$submit = $submit . "<index_algorithm name=\"$index_algorithm_string\" version=\"$index_algorithm_version\">\n";
$submit = $submit . "<media id=\"$photo_id\" src=\"$site_url/image.display.php?image=$photo_id\" />\n";
$submit = $submit . "</index_algorithm>\n";
$submit = $submit . "</submit>\n";
if ($verbose) {
print "<h2>Request</h2>";
print "<p><code>\n";
display_xml($submit);
print "</code></p>\n";
}
socket_write ($socket, $submit, strlen($submit));
if ($verbose) {
print "<h2>Reply</h2>";
print "<p><code>\n";
}
do {
if (FALSE === ($out = socket_read ($socket, 2048, PHP_NORMAL_READ))) {
break;
}
if ($verbose) {
display_xml($out);
}
} while (true);
if ($verbose) {
print"</code></p>\n";
}
socket_close($socket);
error_reporting(1);
return TRUE;
}
function audit_photo($database, $photo_id) {
global $site_url;
global $cbir_host;
global $cbir_port;
$session_id = session_id();
$verbose = TRUE;
if (($cbir_host == "") || ($cbir_port == ""))
return FALSE;
error_reporting(0);
$socket = socket_create (AF_INET, SOCK_STREAM, 0);
if ($socket == FALSE) {
error_reporting(1);
return FALSE;
}
$result = socket_connect ($socket, $cbir_host, $cbir_port);
if ($result == FALSE) {
error_reporting(1);
return FALSE;
}
$index_algorithm_string = substr($index_algorithm, 0, strrpos($index_algorithm, ":"));
$index_algorithm_version = substr($index_algorithm, strrpos($index_algorithm, ":") + 1);
$audit = "<?xml version=\"1.0\" standalone=\"yes\" ?>\n";
$audit = $audit . "<audit id=\"$session_id\">\n";
$audit = $audit . "<vacuum>\n";
if ($photo_id == "all")
$audit = $audit . "<media id=\"$photo_id\" src=\"$photo_id\" />\n";
else
$audit = $audit . "<media id=\"$photo_id\" src=\"$site_url/image.display.php?image=$photo_id\" />\n";
$audit = $audit . "</vacuum>\n";
$audit = $audit . "</audit>\n";
if ($verbose) {
print "<h2>Request</h2>";
print "<p><code>\n";
display_xml($audit);
print "</code></p>\n";
}
socket_write ($socket, $audit, strlen($audit));
if ($verbose) {
print "<h2>Reply</h2>";
print "<p><code>\n";
}
do {
if (FALSE === ($out = socket_read ($socket, 2048, PHP_NORMAL_READ))) {
break;
}
if ($verbose) {
display_xml($out);
}
} while (true);
if ($verbose) {
print"</code></p>\n";
}
socket_close($socket);
error_reporting(1);
return TRUE;
}
function startAlgorithmElement($parser, $name, $attribs) {
global $algorithm_list;
global $algorithm_counter;
switch ($name) {
case "QUERY":
break;
case "INDEX_ALGORITHM_LIST":
case "SEARCH_ALGORITHM_LIST":
$algorithm_list = array();
$algorithm_counter = 0;
break;
case "INDEX_ALGORITHM":
case "SEARCH_ALGORITHM":
if (sizeof($attribs)) {
while (list($attribute, $value) = each($attribs)) {
switch ($attribute) {
case "NAME":
$algorithm_list[$algorithm_counter]['name'] = $value;
break;
case "VERSION":
$algorithm_list[$algorithm_counter]['version'] = $value;
break;
case "COEF":
$algorithm_list[$algorithm_counter]['coef'] = $value;
break;
case "DESC":
$algorithm_list[$algorithm_counter]['desc'] = $value;
break;
}
}
}
break;
}
}
function endAlgorithmElement($parser, $name) {
global $algorithm_counter;
switch ($name) {
case "INDEX_ALGORITHM":
case "SEARCH_ALGORITHM":
$algorithm_counter++;
break;
}
}
function retrieve_argon_algorithm_list($identifier, $cbir_host, $cbir_port, $type) {
$verbose = TRUE;
/* $type = ["index", "search"]*/
if (($cbir_host == "") || ($cbir_port == ""))
return FALSE;
error_reporting(0);
$socket = socket_create (AF_INET, SOCK_STREAM, 0);
if ($socket == FALSE) {
error_reporting(1);
return FALSE;
}
$result = socket_connect ($socket, $cbir_host, $cbir_port);
if ($result == FALSE) {
error_reporting(1);
return FALSE;
}
$query = "<?xml version=\"1.0\" standalone=\"yes\" ?>\n";
$query = $query . "<query id=\"$identifier\">\n";
$query = $query . "<".$type."_algorithm_list />\n";
$query = $query . "</query>\n";
socket_write ($socket, $query, strlen($query));
if ($verbose) {
print "<h2>Request</h2>";
print "<p><code>\n";
display_xml($submit);
print "</code></p>\n";
}
$xml_parser = xml_parser_create();
xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, TRUE);
xml_set_element_handler($xml_parser, "startAlgorithmElement", "endAlgorithmElement");
if ($verbose) {
print "<h2>Reply</h2>";
print "<p><code>\n";
}
do {
if (FALSE === ($out = socket_read ($socket, 2048, PHP_NORMAL_READ))) {
break;
}
if (!xml_parse($xml_parser, $out)) {
print sprintf("<font color=red>%s, XML error: %d %s in file data.xml at line %d</font>\n<p>\n",
$out,
xml_get_error_code($xml_parser),
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser));
xml_parser_free($xml_parser);
socket_close($socket);
error_reporting(1);
exit;
}
if ($verbose) {
display_xml($out);
}
} while (true);
if ($verbose) {
print"</code></p>\n";
}
xml_parser_free($xml_parser);
socket_close($socket);
error_reporting(1);
return TRUE;
}
function create_argon_algorithm_combo($item, $algorithm_list, $value) {
$combo = "<select name=\"".$item."\">";
foreach ($algorithm_list as $element) {
$combined_name = $element['name'].":".$element['version'];
$combo .= "<option value=\"".$combined_name."\"";
if ($element['desc'] || $element['version']) {
$combo .= " title=\"".$element['desc']." version: ".$element['version'] ."\"";
}
if ($value == $combined_name)
$combo .= " selected=\"selected\"";
$combo .= ">".$element['name'] . " " . $element['version'] . "</option>";
}
$combo .= "</select>";
return $combo;
}
function create_submit_header($id) {
$header = "<?xml version=\"1.0\" standalone=\"yes\" ?>\n";
$header = $header . "<submit id=\"$id\">\n";
return $header;
}
function create_query_header($id, $type) {
$header = "<?xml version=\"1.0\" standalone=\"yes\" ?>\n";
$header = $header . "<query id=\"$id\" type=\"$type\">\n";
return $header;
}
function create_search_algorithm_header($algorithm, $version, $limit, $offset) {
$header = "<search_algorithm name=\"$algorithm\" version=\"$version\" ";
if ($limit)
$header = $header . " limit=\"$limit\" ";
if ($offset)
$header = $header . " offset=\"$offset\" ";
$header = $header . ">\n";
return $header;
}
function create_index_algorithm_header($algorithm, $version) {
$header = "<index_algorithm name=\"$algorithm\" version=\"$version\">\n";
return $header;
}
function create_body($photo_id, $photo_id_src) {
return "<media id=\"$photo_id\" src=\"$photo_id_src\" />\n";
}
function create_index_algorithm_footer() {
return "</index_algorithm>\n";
}
function create_search_algorithm_footer() {
return "</search_algorithm>\n";
}
function create_submit_footer() {
return "</submit>\n";
}
function create_query_footer() {
return "</query>\n\n";
}
?>

View File

@ -35,8 +35,6 @@ function emit_date_field_combo($item_name, $value) {
function search_i18n_data() {
global $strings;
global $search_interface;
global $cbir_host;
global $cbir_port;
$search_interface = array("text_general" => array("idx" => 1, 'link' => "search.text.general.php", "alt" => $strings['search_gen_text']),
"text_advanced" => array("idx" => 2, 'link' => "search.text.advanced.php", "alt" => $strings['search_adv_text']));
@ -44,11 +42,6 @@ function search_i18n_data() {
$search_interface["folder"] = array("idx" => 3, 'link' => 'search.folder.php', 'alt' => $strings['search_folders']);
$search_interface["users"] = array("idx" => 4, 'link' => 'search.users.php', 'alt' => $strings['search_users']);
$search_interface["tags"] = array("idx" => 5, 'link' => generate_link('tag', ''), 'alt' => $strings['search_tags']);
if ($cbir_host || $cbir_port) {
$search_interface["image_layout"] = array("idx" => 5, 'link' => "search.image.layout.php", "alt" => $strings['search_img_layout']);
$search_interface["image_color"] = array("idx" => 6, 'link' => "search.image.color.php", "alt" => $strings['search_img_color']);
}
}
$generate_i18n_data[] = "search_i18n_data";

View File

@ -22,14 +22,9 @@ $tools_data = array();
function tools_i18n_data() {
global $strings;
global $tools_data;
global $cbir_host;
$tools_data = array("bulkupdate" => array("idx" => 1, 'link' => "my.tools.php?selector=1", "alt" => $strings['generic_bulk_update']),
"generator" => array("idx" => 2, 'link' => "my.tools.php?selector=2", "alt" => $strings['tools_xml_template_generator']));
if ($cbir_host != "") {
$tools_data['content_indexer'] = array("idx" => 3, 'link' => "my.tools.php?selector=3", "alt" => $strings['tools_content_indexer']);
}
}
$generate_i18n_data[] = "tools_i18n_data";

Binary file not shown.

View File

@ -1,574 +0,0 @@
// Copyright (C) 2005 Balint Kis (balint@k-i-s.net)
// 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 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import java.applet.*;
import java.applet.Applet;
import java.net.*;
import java.io.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.text.*;
import javax.swing.border.*;
import javax.accessibility.*;
class BButton {
int offsetX, offsetY;
Dimension dimension;
boolean isPressed;
boolean isHighLighted;
Image image[];
Applet applet;
public BButton(Applet applet, int offsetX, int offsetY, Dimension dimension, String fileName) {
this.offsetX = offsetX;
this.offsetY = offsetY;
this.dimension = dimension;
this.isPressed = false;
this.isHighLighted = false;
this.applet = applet;
image = new Image[4];
image[0] = applet.getImage(applet.getDocumentBase(), fileName + ".normal.gif");
image[1] = applet.getImage(applet.getDocumentBase(), fileName + ".pressed.gif");
image[2] = applet.getImage(applet.getDocumentBase(), fileName + ".highlighted.gif");
image[3] = applet.getImage(applet.getDocumentBase(), fileName + ".disabled.gif");
}
public boolean isInFocus(int cx, int cy) {
return ((cx > offsetX) && (cx < (offsetX + dimension.width)) &&
(cy > offsetY) && (cy < (offsetY + dimension.height)));
}
public void setHighLight(boolean isHighLighted) {
this.isHighLighted = isHighLighted;
if (!isHighLighted)
isPressed = false;
}
public void setStatus(boolean isPressed) {
this.isPressed = isPressed;
}
public void paint(Graphics g) {
if (isPressed) {
g.drawImage(image[1], offsetX, offsetY, applet);
return;
}
if (isHighLighted) {
g.drawImage(image[2], offsetX, offsetY, applet);
return;
}
g.drawImage(image[0], offsetX, offsetY, applet);
}
}
class ColorChooser {
int offsetX, offsetY;
int markerX, markerY;
Dimension dimension;
Applet applet;
private int[] colorMap;
private Image imageMap = null;
public ColorChooser(Applet applet, int offsetX, int offsetY, Dimension dimension){
this.offsetX = offsetX;
this.offsetY = offsetY;
this.dimension = dimension;
this.applet = applet;
colorMap = new int[dimension.width * dimension.height];
for (int x = 0; x < dimension.width; x++){
for (int y = 1; y <= dimension.height; y++){
float H = ((float) x)*((float)1/(float)dimension.width);
float S = 1;
if (y > (float)dimension.height/(float)2) {
S = (1-((float)y/(float)dimension.height))*(float)2;
}
float B = 1;
if (y < (float)dimension.height/(float)2) {
B = ((float)y/(float)dimension.height)*(float)2;
}
colorMap[x + (dimension.height - y) * dimension.width] = Color.HSBtoRGB(H, S, B);
}
}
imageMap = applet.createImage(new MemoryImageSource(dimension.width, dimension.height, colorMap, 0, dimension.width));
}
public void paint(Graphics g) {
g.drawImage(imageMap, offsetX, offsetY, applet);
g.setColor(Color.gray);
g.drawLine(offsetX, offsetY, offsetX, offsetY + dimension.height);
g.drawLine(offsetX, offsetY + dimension.height, offsetX + dimension.width, offsetY + dimension.height);
g.drawLine(offsetX + dimension.width, offsetY + dimension.height, offsetX + dimension.width, offsetY);
g.drawLine(offsetX + dimension.width, offsetY, offsetX, offsetY);
g.setColor(Color.orange);
g.drawLine(offsetX + markerX - 11, offsetY + markerY - 1, offsetX + markerX + 11, offsetY + markerY - 1);
g.drawLine(offsetX + markerX - 11, offsetY + markerY, offsetX + markerX + 11, offsetY + markerY);
g.drawLine(offsetX + markerX - 11, offsetY + markerY + 1, offsetX + markerX + 11, offsetY + markerY + 1);
g.drawLine(offsetX + markerX - 1, offsetY + markerY - 11, offsetX + markerX - 1, offsetY + markerY + 11);
g.drawLine(offsetX + markerX, offsetY + markerY - 11, offsetX + markerX, offsetY + markerY + 11);
g.drawLine(offsetX + markerX + 1, offsetY + markerY - 11, offsetX + markerX + 1, offsetY + markerY + 11);
g.setColor(Color.black);
g.drawLine(offsetX + markerX - 10, offsetY + markerY, offsetX + markerX + 10, offsetY + markerY);
g.drawLine(offsetX + markerX, offsetY + markerY - 10, offsetX + markerX, offsetY + markerY + 10);
}
public boolean isInFocus(int cx, int cy) {
return ((cx > offsetX) && (cx < (offsetX + dimension.width)) &&
(cy > offsetY) && (cy < (offsetY + dimension.height)));
}
public Color getColor(int x, int y){
markerX = x - offsetX;
markerY = y - offsetY;
return new Color(colorMap[markerX + markerY * dimension.width]);
}
// public void setColorMarker(Color color){
// for (int x = 0; x < dimension.width; x++){
// for (int y = 1; y <= dimension.height; y++){
// float H = ((float)x/(float)dimension.width);
// float S = 1;
// if (y > (float)dimension.height/(float)2) {
// S = (1-((float)y/(float)dimension.height))*(float)2;
// }
// float B = 1;
// if (y < (float)dimension.height/(float)2) {
// B = ((float)y/(float)dimension.height)*(float)2;
// }
// if (color == new Color(Color.HSBtoRGB(H, S, B))) {
// markerX = x;
// markerY = y;
// return;
// }
// }
// }
// }
}
class ColorStack {
Color currentColor;
Color colorStack[];
int offsetX, offsetY;
int selectedColorIndex;
int currentColorIndex;
int depth;
Dimension dimension;
ColorStack(int depth, int offsetX, int offsetY, Dimension dimension) {
this.depth = depth;
this.offsetX = offsetX;
this.offsetY = offsetY;
this.dimension = dimension;
/* create the initial color stack */
colorStack = new Color[depth];
for (int x = 0; x < depth; x++)
colorStack[x] = null;
currentColorIndex = depth - 1;
selectedColorIndex = depth;
}
public void paint(Graphics g) {
for (int x = 0; x < depth; x++) {
if (colorStack[x] == null)
continue;
g.setColor(colorStack[x]);
g.fillRect(offsetX, offsetY + x * dimension.height, dimension.width, dimension.height);
}
/* draw grids */
g.setColor(Color.gray);
g.drawLine(offsetX, offsetY, offsetX, offsetY + depth * dimension.height);
for (int x = 0; x <= depth; x++)
g.drawLine(offsetX, offsetY + x * dimension.height, offsetX + dimension.width, offsetY + x * dimension.height);
g.drawLine(offsetX + dimension.width, offsetY, offsetX + dimension.width, offsetY + depth * dimension.height);
/* draw marker */
if (selectedColorIndex < depth) {
g.setColor(Color.black);
g.drawLine(offsetX, offsetY + (selectedColorIndex) * dimension.height, offsetX + dimension.width, offsetY + (selectedColorIndex) * dimension.height);
g.drawLine(offsetX, offsetY + (selectedColorIndex + 1) * dimension.height, offsetX + dimension.width, offsetY + (selectedColorIndex + 1) * dimension.height);
g.drawLine(offsetX, offsetY + (selectedColorIndex) * dimension.height, offsetX, offsetY + (selectedColorIndex + 1) * dimension.height);
g.drawLine(offsetX + dimension.width, offsetY + (selectedColorIndex) * dimension.height, offsetX + dimension.width, offsetY + (selectedColorIndex + 1) * dimension.height);
g.setColor(Color.black);
g.drawLine(offsetX - dimension.height, offsetY + (selectedColorIndex) * dimension.height,
offsetX - dimension.height, offsetY + (selectedColorIndex + 1) * dimension.height);
g.drawLine(offsetX - dimension.height, offsetY + (selectedColorIndex) * dimension.height,
offsetX - dimension.height/2, offsetY + (selectedColorIndex) * dimension.height + dimension.height/2);
g.drawLine(offsetX - dimension.height/2, offsetY + (selectedColorIndex) * dimension.height + dimension.height/2,
offsetX - dimension.height, offsetY + (selectedColorIndex + 1) * dimension.height);
g.drawLine(offsetX + dimension.width + dimension.height, offsetY + (selectedColorIndex) * dimension.height,
offsetX + dimension.width + dimension.height, offsetY + (selectedColorIndex + 1) * dimension.height);
g.drawLine(offsetX + dimension.width + dimension.height, offsetY + (selectedColorIndex) * dimension.height,
offsetX + dimension.width + dimension.height/2, offsetY + (selectedColorIndex) * dimension.height + dimension.height/2);
g.drawLine(offsetX + dimension.width + dimension.height/2, offsetY + (selectedColorIndex) * dimension.height + dimension.height/2,
offsetX + dimension.width + dimension.height, offsetY + (selectedColorIndex + 1) * dimension.height);
}
}
public boolean isInFocus(int cx, int cy) {
/* mark selected item */
for (int index = 0; index < depth; index++) {
if ((cx > (offsetX)) && (cx < (offsetX + dimension.width)) &&
(cy > (offsetY + index * dimension.height)) && (cy < (offsetY + (index + 1) * dimension.height))) {
if (colorStack[index] != null) {
selectedColorIndex = index;
return true;
}
}
}
return false;
}
public Color getColor() {
return colorStack[selectedColorIndex];
}
public void setCurrentColor(Color newColor) {
currentColor = newColor;
}
public void insertNew() {
if (currentColorIndex > -1) {
colorStack[currentColorIndex] = currentColor;
if (currentColorIndex == (depth - 1))
selectedColorIndex = currentColorIndex;
currentColorIndex--;
}
}
public void clearCurrent() {
for (int x = selectedColorIndex; x >= 1; x--)
colorStack[x] = colorStack[x-1];
colorStack[0] = null;
currentColorIndex++;
if (selectedColorIndex == currentColorIndex)
selectedColorIndex++;
}
public void clearAll() {
for (int x = 0; x < depth; x++)
colorStack[x] = null;
currentColorIndex = depth - 1;
selectedColorIndex = depth;
}
public String getStackContentString() {
int effectiveDepth = 0;
for (int x = 0; x < depth; x++)
if (colorStack[x] != null)
effectiveDepth++;
String parameters = "submit=yes" + "&width=" + effectiveDepth + "&height=" + 1;
for (int x = 0; x < depth; x++)
if (colorStack[depth - 1 - x] != null) {
int red = colorStack[depth - 1 - x].getRed();
int green = colorStack[depth - 1 - x].getGreen();
int blue = colorStack[depth - 1 - x].getBlue();
parameters = parameters + "&px" + x + "=" + Integer.toHexString(blue + 256 * (green + 256 * red));
}
return parameters;
}
}
class ColorPreview {
int offsetX, offsetY;
Dimension dimension;
Color color;
Applet applet;
public ColorPreview(Applet applet, int offsetX, int offsetY, Dimension dimension){
this.offsetX = offsetX;
this.offsetY = offsetY;
this.dimension = dimension;
this.applet = applet;
this.color = Color.white;
}
public void paint(Graphics g) {
g.setColor(color);
g.fillRect(offsetX, offsetY, dimension.width, dimension.height);
g.setColor(Color.gray);
g.drawLine(offsetX, offsetY, offsetX, offsetY + dimension.height);
g.drawLine(offsetX, offsetY + dimension.height, offsetX + dimension.width, offsetY + dimension.height);
g.drawLine(offsetX + dimension.width, offsetY + dimension.height, offsetX + dimension.width, offsetY);
g.drawLine(offsetX + dimension.width, offsetY, offsetX, offsetY);
}
public void setPreviewColor(Color color) {
this.color = color;
}
public Color getPreviewColor() {
return color;
}
}
public class ColorSearch extends Applet implements Runnable, MouseListener, MouseMotionListener {
Thread canvasPainter;
Image offScreen;
Dimension offScreensize;
Graphics offGraphics;
Dimension dimensionCanvas;
ColorStack colorStack;
ColorPreview colorPreview;
ColorChooser colorChooser;
BButton buttonInsert;
BButton buttonClear;
BButton buttonClearAll;
BButton buttonSubmit;
String imagePath = null;
String submitStringURL = null;
URL submitAnchorURL = null;
int depth = 15;
public void init() {
String parameter;
dimensionCanvas = new Dimension(400, 400);
if ((parameter = getParameter("width")) != null)
dimensionCanvas.width = Integer.parseInt(parameter);
if ((parameter = getParameter("height")) != null)
dimensionCanvas.height = Integer.parseInt(parameter);
if ((imagePath = getParameter("image_path")) == null)
imagePath = "";
submitStringURL = getParameter("submit_url");
if (submitStringURL != null) {
try {
submitAnchorURL = new URL(submitStringURL);
} catch (MalformedURLException e) {
System.err.println("ColorSearch: Parse error: " + e);
}
}
colorChooser = new ColorChooser(this, 0, 0, new Dimension(dimensionCanvas.width - 160, dimensionCanvas.height));
buttonClear = new BButton (this, dimensionCanvas.width - 130, 0, new Dimension(72, 25), getCodeBase() + imagePath + "/clear");
buttonClearAll = new BButton (this, dimensionCanvas.width - 130, 30, new Dimension(72, 25), getCodeBase() + imagePath + "/clear.all");
colorPreview = new ColorPreview(this, dimensionCanvas.width - 130, 60, new Dimension(72, 25));
buttonInsert = new BButton (this, dimensionCanvas.width - 130, 90, new Dimension(72, 25), getCodeBase() + imagePath + "/insert");
colorStack = new ColorStack (depth,dimensionCanvas.width - 130, 120, new Dimension(72, (dimensionCanvas.height - 151)/depth));
buttonSubmit = new BButton (this, dimensionCanvas.width - 130, dimensionCanvas.height - 30, new Dimension(72, 25), getCodeBase() + imagePath + "/submit");
addMouseListener(this);
for (int index = 0; index < depth; index++) {
String colorString = getParameter("px" + index);
if ((colorString == null) || (colorString == ""))
continue;
colorString = colorString.replaceAll("#", "");
Color currentColor = new Color(Integer.parseInt(colorString, 16));
colorStack.setCurrentColor(currentColor);
colorStack.insertNew();
}
}
public void destroy() {
removeMouseListener(this);
}
public void start() {
canvasPainter = new Thread(this);
canvasPainter.start();
}
public synchronized void stop() {
canvasPainter = null;
notify();
}
public void submitSearch(URL submitAnchorURL) {
try {
String parameters = colorStack.getStackContentString();
if (parameters =="")
return;
URL submitURL = new URL(submitAnchorURL + "?" + parameters);
getAppletContext().showDocument(submitURL);
} catch (Exception e) {
System.err.println("ColorSearch: HTTP Post Error: " + e);
}
}
public void paint(Graphics g) {
}
public synchronized void startAnimation() {
notify();
}
public void run() {
Thread me = Thread.currentThread();
while (canvasPainter == me) {
repaint();
try {
Thread.sleep(100);
}
catch (InterruptedException e) {
break;
}
}
}
public synchronized void update(Graphics graphics) {
Dimension d = getSize();
if ((offScreen == null) || (d.width != offScreensize.width) || (d.height != offScreensize.height)) {
offScreen = createImage(d.width, d.height);
offScreensize = d;
offGraphics = offScreen.getGraphics();
offGraphics.setFont(getFont());
}
offGraphics.setColor(Color.white);
offGraphics.fillRect(0, 0, d.width, d.height);
paint(offGraphics);
buttonInsert.paint(offGraphics);
buttonClear.paint(offGraphics);
buttonClearAll.paint(offGraphics);
buttonSubmit.paint(offGraphics);
colorStack.paint(offGraphics);
colorChooser.paint(offGraphics);
colorPreview.paint(offGraphics);
graphics.drawImage(offScreen, 0, 0, null);
}
public void mousePressed(MouseEvent e) {
addMouseMotionListener(this);
buttonInsert.setStatus(buttonInsert.isInFocus(e.getX(), e.getY()));
buttonClear.setStatus(buttonClear.isInFocus(e.getX(), e.getY()));
buttonClearAll.setStatus(buttonClearAll.isInFocus(e.getX(), e.getY()));
buttonSubmit.setStatus(buttonSubmit.isInFocus(e.getX(), e.getY()));
if (colorChooser.isInFocus(e.getX(), e.getY())) {
Color currentColor;
currentColor = colorChooser.getColor(e.getX(), e.getY());
colorStack.setCurrentColor(currentColor);
colorPreview.setPreviewColor(currentColor);
}
mouseClicked(e);
}
public void mouseDragged(MouseEvent e) {
if (colorChooser.isInFocus(e.getX(), e.getY())) {
Color currentColor;
currentColor = colorChooser.getColor(e.getX(), e.getY());
colorStack.setCurrentColor(currentColor);
colorPreview.setPreviewColor(currentColor);
}
mouseClicked(e);
}
public void mouseClicked(MouseEvent e) {
repaint();
e.consume();
}
public void mouseReleased(MouseEvent e) {
removeMouseMotionListener(this);
if (buttonInsert.isInFocus(e.getX(), e.getY())) {
buttonInsert.setStatus(false);
Color currentColor = colorPreview.getPreviewColor();
colorStack.setCurrentColor(currentColor);
colorStack.insertNew();
}
if (buttonClear.isInFocus(e.getX(), e.getY())) {
buttonClear.setStatus(false);
colorStack.clearCurrent();
}
if (buttonClearAll.isInFocus(e.getX(), e.getY())) {
buttonClearAll.setStatus(false);
colorStack.clearAll();
}
if (buttonSubmit.isInFocus(e.getX(), e.getY())) {
buttonSubmit.setStatus(false);
if (submitAnchorURL != null) {
submitSearch(submitAnchorURL);
}
}
if (colorStack.isInFocus(e.getX(), e.getY())) {
Color currentColor = colorStack.getColor();
// colorChooser.setColorMarker(currentColor);
// colorChooser.paint(offGraphics);
colorPreview.setPreviewColor(currentColor);
}
repaint();
e.consume();
}
public void mouseEntered(MouseEvent e) {
mouseMoved(e);
}
public void mouseExited(MouseEvent e) {
mouseMoved(e);
}
public void mouseMoved(MouseEvent e) {
buttonInsert.setHighLight(buttonInsert.isInFocus(e.getX(), e.getY()));
buttonClear.setHighLight(buttonClear.isInFocus(e.getX(), e.getY()));
buttonClearAll.setHighLight(buttonClearAll.isInFocus(e.getX(), e.getY()));
buttonSubmit.setHighLight(buttonSubmit.isInFocus(e.getX(), e.getY()));
e.consume();
}
public String getAppletInfo() {
return "Photo Organizer Color Search Client v1.0 \n Copyright (C) 2005, Balint Kis (balint@k-i-s.net).";
}
public String[][] getParameterInfo() {
String[][] info = {
{"width", "int", "width of the applet in pixels"},
{"height", "int", "height of the applet in pixels"},
{"image_path", "URL", "URL pointing to the images"},
{"submit_url", "URL", "submit URL"}
};
return info;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 954 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 954 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 954 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 954 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Binary file not shown.

View File

@ -1,438 +0,0 @@
// Copyright (C) 2005 Balint Kis (balint@k-i-s.net)
// 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 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.applet.Applet;
import java.net.*;
import java.io.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.text.*;
import javax.swing.border.*;
import javax.swing.colorchooser.*;
import javax.swing.filechooser.*;
import javax.accessibility.*;
class BButton {
int offsetX, offsetY;
int height, width;
boolean isPressed;
boolean isHighLighted;
Image image[];
Applet applet;
public BButton(Applet applet, int offsetX, int offsetY, int width, int height, String fileName) {
this.offsetX = offsetX;
this.offsetY = offsetY;
this.height = height;
this.width = width;
this.isPressed = false;
this.isHighLighted = false;
this.applet = applet;
image = new Image[4];
image[0] = applet.getImage(applet.getDocumentBase(), fileName + ".normal.gif");
image[1] = applet.getImage(applet.getDocumentBase(), fileName + ".pressed.gif");
image[2] = applet.getImage(applet.getDocumentBase(), fileName + ".highlighted.gif");
image[3] = applet.getImage(applet.getDocumentBase(), fileName + ".disabled.gif");
}
public boolean isInFocus(int cx, int cy) {
return ((cx > offsetX) && (cx < (offsetX + width)) &&
(cy > offsetY) && (cy < (offsetY + height)));
}
public void setHighLight(boolean isHighLighted) {
this.isHighLighted = isHighLighted;
if (!isHighLighted)
isPressed = false;
}
public void setStatus(boolean isPressed) {
this.isPressed = isPressed;
}
public void paint(Graphics g) {
if (isPressed) {
g.drawImage(image[1], offsetX, offsetY, applet);
return;
}
if (isHighLighted) {
g.drawImage(image[2], offsetX, offsetY, applet);
return;
}
g.drawImage(image[0], offsetX, offsetY, applet);
}
}
class Cell {
boolean isHighLighted;
Color color;
Cell(boolean isHighLighted, Color color) {
this.isHighLighted = isHighLighted;
this.color = color;
}
}
class ColorHistory {
Color color[];
int offsetX, offsetY;
int currentColorIndex;
Dimension dimension;
ColorHistory(int offsetX, int offsetY, Dimension dimension) {
this.offsetX = offsetX;
this.offsetY = offsetY;
this.dimension = dimension;
/* create the initial colormap */
color = new Color[9];
color[0] = Color.black;
color[1] = Color.white;
color[2] = Color.red;
color[3] = Color.green;
color[4] = Color.blue;
color[5] = Color.yellow;
color[6] = Color.cyan;
color[7] = Color.magenta;
color[8] = Color.orange;
currentColorIndex = 0;
}
public void Display(Graphics g) {
/* draw color cells */
for (int x = 0; x < 9; x++) {
g.setColor(color[x]);
g.fillRect(offsetX + x * dimension.width,
offsetY,
dimension.width,
dimension.height);
}
/* draw grids */
g.setColor(Color.gray);
g.drawLine(offsetX, offsetY, offsetX+dimension.width*9, offsetY);
for (int x = 0; x < 10; x++)
g.drawLine(offsetX + x * dimension.width, offsetY, offsetX + x * dimension.width, offsetY+dimension.height);
g.drawLine(offsetX, offsetY+dimension.height, offsetX+dimension.width*9, offsetY+dimension.height);
g.setColor(color[currentColorIndex]);
int x1 = offsetX - 3 + currentColorIndex * dimension.width;
int y1 = offsetY - 3;
int x2 = dimension.width + 7;
int y2 = dimension.height + 7;
g.fillRect(x1, y1, x2, y2);
x2 += x1 - 1;
y2 += y1 - 1;
g.setColor(Color.gray);
g.drawLine(x1, y1, x1, y2);
g.drawLine(x2, y1, x2, y2);
g.drawLine(x1, y1, x2, y1);
g.drawLine(x1, y2, x2, y2);
}
public void isInFocus(int cx, int cy) {
for (int index = 0; index < 9; index++) {
if ((cx > (offsetX + index * dimension.width)) && (cx < (offsetX + (index+1) * dimension.width)) &&
(cy > (offsetY)) && (cy < (offsetY + dimension.height))) {
currentColorIndex = index;
}
}
}
public Color getColor() {
return color[currentColorIndex];
}
public void setColor(Color newColor) {
color[currentColorIndex] = newColor;
}
}
public class LayoutSearch extends Applet implements Runnable, MouseListener, MouseMotionListener {
Thread canvasPainter;
Image offScreen;
Dimension offScreensize;
Graphics offGraphics;
int numOfCellsX;
int numOfCellsY;
Dimension dimensionCanvas;
Dimension dimensionCell;
Cell cell[][];
ColorHistory colorHistory;
BButton buttonClear;
BButton buttonColorChooser;
BButton buttonSubmit;
String imagePath = null;
String submitStringURL = null;
URL submitAnchorURL = null;
public void init() {
String parameter;
numOfCellsX = 10;
numOfCellsY = 10;
dimensionCanvas = new Dimension(400,400);
if ((parameter = getParameter("canvas_width")) != null)
dimensionCanvas.width = Integer.parseInt(parameter);
if ((parameter = getParameter("canvas_height")) != null)
dimensionCanvas.height = Integer.parseInt(parameter);
if ((parameter = getParameter("horizontal_cell_count")) != null)
numOfCellsX = Integer.parseInt(parameter);
if ((parameter = getParameter("vertical_cell_count")) != null)
numOfCellsY = Integer.parseInt(parameter);
if ((imagePath = getParameter("image_path")) == null)
imagePath = "";
submitStringURL = getParameter("submit_url");
if (submitStringURL != null) {
try {
submitAnchorURL = new URL(submitStringURL);
} catch (MalformedURLException e) {
System.err.println("LayoutSearch: Parse error: " + e);
}
}
buttonClear = new BButton(this, 10, dimensionCanvas.height - 30, 103, 25, getCodeBase() + imagePath + "/clear");
buttonColorChooser = new BButton(this, 143, dimensionCanvas.height - 30, 84, 25, getCodeBase() + imagePath + "/color.chooser");
buttonSubmit = new BButton(this, dimensionCanvas.width - 68, dimensionCanvas.height - 30, 58, 25, getCodeBase() + imagePath + "/submit");
colorHistory = new ColorHistory(237, dimensionCanvas.height - 30, new Dimension(24, 24));
dimensionCanvas.height -= 30;
dimensionCanvas.height = (dimensionCanvas.height / numOfCellsY) * numOfCellsY;
dimensionCanvas.width = (dimensionCanvas.width / numOfCellsX) * numOfCellsX;
dimensionCell = new Dimension(dimensionCanvas.width / numOfCellsX, dimensionCanvas.height / numOfCellsY);
cell = new Cell[numOfCellsX][numOfCellsY];
for (int y = 0; y < numOfCellsY; y++)
for (int x = 0; x < numOfCellsX ; x++) {
int index = y * numOfCellsX + x;
String colorString = getParameter("px" + index);
if ((colorString == null) || (colorString == "")) {
cell[x][y] = new Cell(false, Color.white);
continue;
}
colorString = colorString.replaceAll("#", "");
Color currentColor = new Color(Integer.parseInt(colorString, 16));
cell[x][y] = new Cell(false, currentColor);
}
addMouseListener(this);
}
public void destroy() {
removeMouseListener(this);
}
public void start() {
canvasPainter = new Thread(this);
canvasPainter.start();
}
public synchronized void stop() {
canvasPainter = null;
notify();
}
public void clearCanvas() {
for (int x = 0; x < numOfCellsX ; x++)
for (int y = 0; y < numOfCellsY; y++) {
cell[x][y].color = Color.white;
}
}
public String getCanvasContentString() {
String parameters = "submit=yes" + "&width=" + numOfCellsX + "&height=" + numOfCellsY;
for (int y = 0; y < numOfCellsY; y++)
for (int x = 0; x < numOfCellsX ; x++) {
int red = cell[x][y].color.getRed();
int green = cell[x][y].color.getGreen();
int blue = cell[x][y].color.getBlue();
int index = y * numOfCellsX + x;
parameters = parameters + "&px" + index + "=" + Integer.toHexString(blue + 256 * (green + 256 * red));
}
return parameters;
}
public void submitSearch(URL submitAnchorURL) {
try {
String parameters = getCanvasContentString();
URL submitURL = new URL(submitAnchorURL + "?" + parameters);
getAppletContext().showDocument(submitURL);
} catch (Exception e) {
System.err.println("LayoutSearch: HTTP Post Error: " + e);
}
}
public void setCellColor(int x, int y, Color color) {
int cellIdxX = numOfCellsX * (x - 1) / dimensionCanvas.width;
int cellIdxY = numOfCellsY * (y - 1) / dimensionCanvas.height;
if (!((cellIdxX >= 0) && (cellIdxX < numOfCellsX) &&
(cellIdxY >= 0) && (cellIdxY < numOfCellsY)))
return;
cell[cellIdxX][cellIdxY].color = color;
}
public void Display(Graphics g) {
/* draw canvas cells */
for (int x = 0; x < numOfCellsX; x++)
for (int y = 0; y < numOfCellsY; y++) {
g.setColor(cell[x][y].color);
g.fillRect(x * dimensionCell.width,
y * dimensionCell.height,
dimensionCell.width,
dimensionCell.height);
}
/* draw grids */
g.setColor(Color.gray);
for (int x = 0; x < numOfCellsX; x++)
g.drawLine(x * dimensionCell.width, 0, x * dimensionCell.width, dimensionCell.height * numOfCellsY);
g.drawLine(dimensionCell.width * numOfCellsX, 0, dimensionCell.width * numOfCellsX, dimensionCell.height * numOfCellsY);
for (int y = 0; y < numOfCellsY; y++)
g.drawLine(0, y * dimensionCell.height, dimensionCell.width * numOfCellsX, y * dimensionCell.height);
g.drawLine(0, dimensionCell.height * numOfCellsY, dimensionCell.width * numOfCellsX, dimensionCell.height * numOfCellsY);
}
public synchronized void startAnimation() {
notify();
}
public void run() {
Thread me = Thread.currentThread();
while (canvasPainter == me) {
repaint();
try {
Thread.sleep(100);
}
catch (InterruptedException e) {
break;
}
}
}
public synchronized void update(Graphics graphics) {
Dimension d = getSize();
if ((offScreen == null) || (d.width != offScreensize.width) || (d.height != offScreensize.height)) {
offScreen = createImage(d.width, d.height);
offScreensize = d;
offGraphics = offScreen.getGraphics();
offGraphics.setFont(getFont());
}
offGraphics.setColor(Color.white);
offGraphics.fillRect(0, 0, d.width, d.height);
Display(offGraphics);
buttonClear.paint(offGraphics);
buttonColorChooser.paint(offGraphics);
buttonSubmit.paint(offGraphics);
colorHistory.Display(offGraphics);
graphics.drawImage(offScreen, 0, 0, null);
}
public void mousePressed(MouseEvent e) {
addMouseMotionListener(this);
buttonClear.setStatus(buttonClear.isInFocus(e.getX(), e.getY()));
buttonColorChooser.setStatus(buttonColorChooser.isInFocus(e.getX(), e.getY()));
buttonSubmit.setStatus(buttonSubmit.isInFocus(e.getX(), e.getY()));
mouseClicked(e);
}
public void mouseDragged(MouseEvent e) {
mouseClicked(e);
}
public void mouseClicked(MouseEvent e) {
setCellColor(e.getX(), e.getY(), colorHistory.getColor());
repaint();
e.consume();
}
public void mouseReleased(MouseEvent e) {
removeMouseMotionListener(this);
if (buttonClear.isInFocus(e.getX(), e.getY())) {
buttonClear.setStatus(false);
clearCanvas();
}
if (buttonColorChooser.isInFocus(e.getX(), e.getY())) {
buttonColorChooser.setStatus(false);
colorHistory.setColor(JColorChooser.showDialog(this, "Select Color", colorHistory.getColor()));
}
if (buttonSubmit.isInFocus(e.getX(), e.getY())) {
buttonSubmit.setStatus(false);
if (submitAnchorURL != null) {
submitSearch(submitAnchorURL);
}
}
colorHistory.isInFocus(e.getX(), e.getY());
repaint();
e.consume();
}
public void mouseEntered(MouseEvent e) {
mouseMoved(e);
}
public void mouseExited(MouseEvent e) {
mouseMoved(e);
}
public void mouseMoved(MouseEvent e) {
buttonClear.setHighLight(buttonClear.isInFocus(e.getX(), e.getY()));
buttonColorChooser.setHighLight(buttonColorChooser.isInFocus(e.getX(), e.getY()));
buttonSubmit.setHighLight(buttonSubmit.isInFocus(e.getX(), e.getY()));
e.consume();
}
public String getAppletInfo() {
return "Photo Organizer Layout Search Client v1.0 \n Copyright (C) 2005, Balint Kis (balint@k-i-s.net)";
}
public String[][] getParameterInfo() {
String[][] info = {
{"canvas_width", "int", "width of the canvas in pixels"},
{"canvas_height", "int", "height of the canvas in pixels"},
{"horizontal_cell_count", "int", "number of horizontal cells"},
{"vertical_cell_count", "int", "number of vertical cells"},
{"image_path", "URL", "url pointing to the images"},
{"submit_url", "URL", "submit url"}
};
return info;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 872 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 872 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 872 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 872 B

View File

@ -1,172 +0,0 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2008 Solomon Peachy (pizza@shaftnet.org)
// 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 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
include_once "include/config.php";
;
include_once "include/site.php";
include_once "include/common.php";
include_once "include/orderby.php";
include_once "include/search.php";
include_once "include/search.2.php";
$database = site_prolog();
$photo_id = pg_escape_string($_REQUEST['photo']);
site_header("Search Image Color");
site_navigator(2);
site_navigator_status("Create a colormap to search for:", "");
print "&nbsp;<br/>\n";
theme_display_navigator_box_top($search_interface['image_color']['idx'], $search_interface, "100%");
if ($photo_id) {
$argon_photo_id = $photo_id;
$search_type = "submit";
$file_name = $site_url."/image.display.php?image=$photo_id&size=1";
display_frame_top();
print "<a class=\"nodecor\" href=\"photo.php?photo=$photo_id\"><img src=\"image.display.php?image=$photo_id&size=1\"/></a>\n";
theme_display_slide_bottom();
}
else {
$argon_photo_id = 1;
$search_type = "no_submit";
print "&nbsp;<br/>\n";
print "<applet codebase=\"java/search.color\" code=\"ColorSearch.class\" width=\"740\" height=\"280\">\n";
print "<param name=\"canvas_width\" value=\"740\"/>\n";
print "<param name=\"canvas_height\" value=\"280\"/>\n";
print "<param name=\"image_path\" value=\"buttons\"/>\n";
print "<param name=\"submit_url\" value=\"$site_url/search.image.color.php\"/>\n";
$width = $_REQUEST['width'];
$height = $_REQUEST['height'];
for ($j = 0; $j < $height; $j++)
for ($i = 0; $i < $width; $i++) {
$index = $j * $width + $i;
$value = $_REQUEST[px.$index];
print "<param name=\"px".$index."\" value=\"".$value."\">\n";
}
print "</applet>\n";
}
theme_display_navigator_box_bottom("100%");
print "&nbsp;<br/>\n";
if (!$photo_id) {
if ($_REQUEST['submit'] != "yes") {
site_footer($database);
site_epilog($database);
exit();
}
$file_name = createXMPFile();
}
$index_algorithm = "ar_index_histogram:0.1.0";
$search_algorithm ="ar_search_kendall:0.1.0";
$limit = $po_options['photos_per_page'];
$offset = 0;
$photo_id_list = array();
$photo_id_counter = 0;
argon_query($cbir_host, $cbir_port, $index_algorithm, $search_algorithm, $search_type, $limit, $offset, $argon_photo_id, $file_name);
if (!$photo_id) {
error_reporting(0);
unlink($file_name);
error_reporting(1);
}
if ($photo_id_list) {
$sql_query_access_rights_string = " can_access_photo(photo.identifier, $po_user[id], '{".$passwords."}')";
$sql_search_string = "";
for ($i = 0; $i < $photo_id_counter; $i++) {
$sql_search_entry =
"(select photo.identifier, photo.caption, date_of_exposure, photo.date_added,
photo.access_rights,
(select avg(rating.value) from rating where rating.photo=photo.identifier) as rating,
photo.users, users.first_name, users.last_name, views,
$i as sort_order
from photo, folder, photo_version, users
where photo.folder = folder.identifier
and photo.users = users.identifier
and photo.identifier = photo_version.photo
and photo_version.master='t'
and photo.identifier = $photo_id_list[$i]
and $sql_query_access_rights_string)";
if ($sql_search_string) {
$sql_search_string = $sql_search_string ." union ". $sql_search_entry;
}
else {
$sql_search_string = $sql_search_entry;
}
}
$sql_search_string = $sql_search_string . " order by sort_order";
$search_result = pg_query($database, $sql_search_string);
$num_of_matches = pg_num_rows($search_result);
}
else {
exit();
}
$arguments = "&amp;search_type=$search_type&amp;offset=$offset";
$search_string_exp = str_replace(" ", "+", $search_string);
print "<form name=\"photoList\" method=\"post\" action=\"folder.content.php\" accept-charset=\"".$strings['formats_encoding']."\">";
print "<input type=\"hidden\" name=\"user\" value=\"$user_id\"/>";
print "<input type=\"hidden\" name=\"return\" value=\"search.image.color.php?search_string=$search_string$arguments\"/>";
print "<input type=\"hidden\" name=\"view\" value=\"$view\"/>";
if (($offset + $limit) > $num_of_matches) {
$items = $num_of_matches - $offset;
} else {
$items = $limit;
}
display_photo_navigator("search.image.color.php?search_string=$search_string$arguments", $offset, $limit, $num_of_matches);
$checkboxes = display_photo_slides("search_general", $folder_id, $search_result, 0, $items, true, true);
display_photo_navigator("search.image.color.php?search_string=$search_string$arguments", $offset, $limit, $num_of_matches);
print "&nbsp;<br/>\n";
site_navigator_status("Searched database for $photo_id", "Displaying photos " . display_photo_index_status($offset, $limit, $num_of_photos));
print "<table align=\"left\" valign=\"middle\" cellpadding=\"0\" border=\"0\">";
print "<tr>";
if ($checkboxes > 0 && $po_user['id']) {
$album_all = pg_query($database, "select identifier, caption from album where users=$po_user[id] order by date_of_creation desc");
if (count($album_all)) {
print "<td align=\"left\" valign=\"middle\">&nbsp;&nbsp;</td><td align=\"left\" valign=\"middle\">";
display_folder_actions($album_all, $album_id);
print "</td>";
}
print "<td align=\"left\" valign=\"middle\">&nbsp;&nbsp;</td>";
print "<td align=\"left\" valign=\"middle\">";
theme_display_selectButton();
print "</td>";
print "</td>";
}
print "</tr>";
print "</table>";
print "</form>";
print "&nbsp;<br/>\n";
site_footer($database);
site_epilog($database);
?>

View File

@ -1,177 +0,0 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2008 Solomon Peachy (pizza@shaftnet.org)
// 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 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
include_once "include/config.php";
;
include_once "include/site.php";
include_once "include/common.php";
include_once "include/orderby.php";
include_once "include/search.php";
include_once "include/search.2.php";
$database = site_prolog();
$photo_id = pg_escape_string($_REQUEST['photo']);
site_header("Search Image Layout");
site_navigator(2);
site_navigator_status("Create an image layout to search for:", "");
print "&nbsp;<br/>\n";
theme_display_navigator_box_top($search_interface['image_layout']['idx'], $search_interface, "100%");
if ($photo_id) {
$argon_photo_id = $photo_id;
$search_type = "submit";
$file_name = $site_url."/image.display.php?image=$photo_id";
display_frame_top();
print "<a class=\"nodecor\" href=\"photo.php?photo=$photo_id\"><img src=\"image.display.php?image=$photo_id&size=1\"/></a>\n";
theme_display_slide_bottom();
}
else {
$argon_photo_id = 1;
$search_type = "no_submit";
print "&nbsp;<br/>\n";
print "<applet codebase=\"java/search.layout\" code=\"LayoutSearch.class\" width=\"601\" height=\"281\">\n";
print "<param name=\"canvas_width\" value=\"600\"/>\n";
print "<param name=\"canvas_height\" value=\"280\"/>\n";
print "<param name=\"horizontal_cell_count\" value=\"37\"/>\n";
print "<param name=\"vertical_cell_count\" value=\"14\"/>\n";
print "<param name=\"image_path\" value=\"buttons\"/>\n";
print "<param name=\"submit_url\" value=\"$site_url/search.image.layout.php\"/>\n";
$width = $_REQUEST['width'];
$height = $_REQUEST['height'];
for ($j = 0; $j < $height; $j++)
for ($i = 0; $i < $width; $i++) {
$index = $j * $width + $i;
$value = $_REQUEST[px.$index];
print "<param name=\"px".$index."\" value=\"".$value."\">\n";
}
print "</applet>\n";
}
theme_display_navigator_box_bottom("100%");
print "&nbsp;<br/>\n";
if (!$photo_id) {
if ($_REQUEST['submit'] != "yes") {
site_footer($database);
site_epilog($database);
exit();
}
$file_name = createXMPFile();
}
$index_algorithm = "ar_index_haar:0.2.0";
$search_algorithm ="ar_search_euclidean:0.1.0";
$limit = $po_options['photos_per_page'];
$offset = 0;
$photo_id_list = array();
$photo_id_counter = 0;
argon_query($cbir_host, $cbir_port, $index_algorithm, $search_algorithm, $search_type, $limit, $offset, $argon_photo_id, $file_name);
if (!$photo_id) {
error_reporting(0);
unlink($file_name);
error_reporting(1);
}
if ($photo_id_list) {
$sql_query_access_rights_string = " can_access_photo(photo.identifier, $po_user[id], '{".$passwords."}')";
$sql_search_string = "";
for ($i = 0; $i < $photo_id_counter; $i++) {
$sql_search_entry =
"(select photo.identifier, photo.caption, date_of_exposure, photo.date_added,
photo.access_rights,
(select avg(rating.value) from rating where rating.photo=photo.identifier) as rating,
photo.users, users.first_name, users.last_name, views,
$i as sort_order
from photo, folder, photo_version, users
where photo.folder = folder.identifier
and photo.users = users.identifier
and photo.identifier = photo_version.photo
and photo_version.master='t'
and photo.identifier = $photo_id_list[$i]
and $sql_query_access_rights_string)";
if ($sql_search_string) {
$sql_search_string = $sql_search_string ." union ". $sql_search_entry;
}
else {
$sql_search_string = $sql_search_entry;
}
}
$sql_search_string = $sql_search_string . " order by sort_order";
$search_result = pg_query($database, $sql_search_string);
$num_of_matches = pg_num_rows($search_result);
}
else {
exit();
}
$arguments = "&amp;search_type=$search_type&amp;offset=$offset";
$search_string_exp = str_replace(" ", "+", $search_string);
print "<form name=\"photoList\" method=\"post\" action=\"folder.content.php\" accept-charset=\"".$strings['formats_encoding']."\">";
print "<input type=\"hidden\" name=\"user\" value=\"$user_id\"/>";
print "<input type=\"hidden\" name=\"return\" value=\"search.image.layout.php?search_string=$search_string$arguments\"/>";
print "<input type=\"hidden\" name=\"view\" value=\"$view\"/>";
if (($offset + $limit) > $num_of_matches) {
$items = $num_of_matches - $offset;
} else {
$items = $limit;
}
display_photo_navigator("search.image.layout.php?search_string=$search_string$arguments", $offset, $limit, $num_of_matches);
$checkboxes = display_photo_slides("search_general", $folder_id, $search_result, $items, true, true);
display_photo_navigator("search.image.layout.php?search_string=$search_string$arguments", $offset, $limit, $num_of_matches);
print "&nbsp;<br/>\n";
site_navigator_status("Searched database for $photo_id", "Displaying photos " . display_photo_index_status($offset, $limit, $num_of_photos));
print "<table align=\"left\" valign=\"middle\" cellpadding=\"0\" border=\"0\">";
print "<tr>";
if ($checkboxes > 0 && $po_user['id']) {
$album_all = pg_query($database, "select identifier, caption from album where users=$po_user[id] and order by date_of_creation desc");
if (count($album_all)) {
print "<td align=\"left\" valign=\"middle\">&nbsp;&nbsp;</td><td align=\"left\" valign=\"middle\">";
display_album_actions($album_all, $album_id);
print "</td>";
}
print "<td align=\"left\" valign=\"middle\">&nbsp;&nbsp;</td>";
print "<td align=\"left\" valign=\"middle\">";
theme_display_selectButton();
print "</td>";
print "</td>";
}
print "</tr>";
print "</table>";
print "</form>";
print "&nbsp;<br/>\n";
site_footer($database);
site_epilog($database);
?>

View File

@ -1,35 +0,0 @@
<?php
// Copyright (C) 2002-2006 Balint Kis (balint@k-i-s.net)
// Copyright (C) 2005-2008 Solomon Peachy (pizza@shaftnet.org)
// 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 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
$photo_id = $_REQUEST['photo_id'];
$type = $_REQUEST['type'];
switch ($type) {
case "color":
header("Location: search.image.color.php?photo=$photo_id");
$exit();
case "layout":
header("Location: search.image.layout.php?photo=$photo_id");
$exit();
default:
header("Location: photo.php?photo=$photo_id");
$exit();
}
?>

View File

@ -36,11 +36,6 @@ if ($po_user['id']) {
case 2:
header("Location: search.text.advanced.php");
break;
case 3:
header("Location: search.image.layout.php");
break;
case 4:
header("Location: search.image.color.php");
}
exit();
}