PDA

View Full Version : Limit the lens used in \"Guess Len\" Process


mwpmo
20th of November 2003 (Thu), 20:02
Pekka,

Is it possible to limits the lens used "Guess Lens" to several lens in my lens collection.

Cause I got many lens their range of focal length are overlaped.

e.g. 17-35 and 24 -70, 50 1.4 and 50 1.8.

I suggest in the UPLOAD page, add a pick list of lens.

Then I just selection the lens I used in those photos I want to upload and the system will just limit the "Guess Lens" process to those selected lens only.

mwpmo
24th of November 2003 (Mon), 20:03
Will it on the to-do list?

Pekka
25th of November 2003 (Tue), 06:27
I would not like to place any such extra selections on upload page - but I will think of something....

jsm
15th of September 2005 (Thu), 00:42
Anyone have a good idea how to make some lenses "obsolete"?

I have quite a few lenses that I don't longer own but which are used in exhibitions so I'd rather not delete them. But I'd like to make them so that they're part of the lens guessing procedure..

Thanks for any thoughts/ideas.

- Jussi

Pekka
15th of September 2005 (Thu), 07:08
One way to do it:

in SCRIPT_add_to_database.php put to beginning (line after first <?php )



$donotsearchlenses = array("1","2","7");

$lens_ids_are_not = "AND (";
foreach ($donotsearchlenses as $key => $k) {
$s_array[] = "ee_lens.ee_lens_id <> '" . $k . "'";
}
$s_explode = @implode (" AND ",$s_array);
$lens_ids_are_not .= $s_explode;
$lens_ids_are_not .= ") ";
if (count($donotsearchlenses) == 0) {
$lens_ids_are_not = "AND ee_lens.ee_lens_id <> '0'";
}
unset($s_array);


Then find

if ($s_upload_guess_lens == "1") {

and after it insert variable $lens_ids_are_not to end of each query inside that if clause, like


$checkmanf = mysql_query(
"SELECT
ee_lens.ee_lens_id,
ee_lens.ee_lens_manufacturer
FROM
ee_lens
WHERE
ee_lens.ee_lens_manufacturer LIKE '{$likeness}'
{$lens_ids_are_not}
");
ee_error ($checkmanf,"checkmanf","ftp upload lens ranking");


You insert lens id's you want to ignore to $donotsearchlenses array.

You can get lens id numbers from database, or by viewing html source of lens editor (in the very end you have the id's in delete form).

This is all just a theory, have not tested it at all :) Let me know if it works or not.

jsm
15th of September 2005 (Thu), 07:47
Thanks pekka, I'll take a look at it later when I have spare time.

The code looks ok, not tested yet but read it thru..
I'll try it later and let you know if it's ok.

One option I had was adding bit-type obsolete field to DB and modifying the lensupdate section and guessing code. Slightly more work there but easier to maintain as lenses come and go ;D (hopefully not in so frequently anymore)

-Jussi

Pekka
15th of September 2005 (Thu), 07:53
Thanks pekka, I'll take a look at it later when I have spare time.

The code looks ok, not tested yet but read it thru..
I'll try it later and let you know if it's ok.

One option I had was adding bit-type obsolete field to DB and modifying the lensupdate section and guessing code. Slightly more work there but easier to maintain as lenses come and go ;D (hopefully not in so frequently anymore)

-Jussi

Yes this will be an editor setting in future.

jsm
15th of September 2005 (Thu), 07:57
ok then there is no point making the DB changes as I have to revert those later then since you woudn't make the fields the same name anyways.

I'll settle for the "quick and dirty" solution for now, thanks Pekka

-Jussi

Pekka
15th of September 2005 (Thu), 08:07
ok then there is no point making the DB changes as I have to revert those later then since you woudn't make the fields the same name anyways.

I'll settle for the "quick and dirty" solution for now, thanks Pekka

-Jussi

We can agree now that the new field is

ALTER TABLE `ee_lens` ADD `ee_lens_noguess` TINYINT( 1 ) DEFAULT '0' NOT NULL ;

the we can just add

AND ee_lens.ee_lens_noguess = '0'

to make those guess queries happen on allowed lenses only, then all we need is a tickbox in lens editor to set the field. Quick and easy workaround way is to use PHPmyadmin to set the values.

jsm
15th of September 2005 (Thu), 15:09
Don't have any mysql tools installed other than commandline tools so I had to edit the lens editor script too a little.

It's working just as intended now.

Hope you stick with the field name now ;D

Thanks,
Jussi