Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - WhiteRabbit

Pages: 1 [2]
16
Hello people.

I'm making a mod to my current template, to allow it to change the height and width values of an image, depending on the visitor's resolution.

Here is the "core" of the modification, the size calculation script. I made it on a separate page with static values for the image name, and it is working OK. But when I adapted it to 4images, it has no effect. I leave here the entire modification, to anyone that wants to debug it...

On header.html add :
Code: [Select]
<script language="JavaScript" type="text/javascript">
function image_size(){
    var AspectRatio, FinalWidth, FinalHeight, DoResize;
    DoResize=0;
    if (screen.width < 1024) {FinalWidth = 640; DoResize=1}
    if (screen.width < 800) {FinalWidth = 480; DoResize=1}
    if ((document.{image_id}.width > document.{image_id}.height) && (DoResize==1))
    { AspectRatio = (document.{image_id}.width / document.{image_id}.height);
FinalHeight = FinalWidth/AspectRatio;
document.{image_id}.width = FinalWidth;
document.{image_id}.height = FinalHeight;}
    if ((document.{image_id}.width < document.{image_id}.height) && (DoResize==1))
    {    AspectRatio = document.{image_id}.height / document.{image_id}.width;
FinalHeight = FinalWidth;
FinalWidth = FinalHeight/AspectRatio;
document.{image_id}.width = FinalWidth;
document.{image_id}.height = FinalHeight;}
    }
</script>

On <template's directory>/template/media/jpg.html change:
Code: [Select]
<!-- Template file for JPG Files -->
<img src="{media_src}" border="1" alt="{image_name}"{width_height} /><br />

with this:
Code: [Select]
<!-- Template file for JPG Files -->
<img src="{media_src}" border="1" alt="{image_name}" name="{image_id}" {width_height} /><br />

On <template's directory>/details.html add:
Code: [Select]
<script language="JavaScript">
image_size();
</script>
just before the tag {footer}

The last part can be added in jpg.html , it don't make difference.
I don't have any debug windows of IE or Mozilla saying that the code is wrong, as I say, it works OK with the object's name static...

Any ideas?.

Best regards.
WR.

17
Great work!

Thanks!.

Best regards.
WR.

18
Tutorials / Re: [Tutorial] Making additional field searchable
« on: August 04, 2005, 03:27:17 AM »
Hello again.

Well, I did find out by myself... check this post:

http://www.4homepages.de/forum/index.php?topic=9148.msg42890#msg42890

Best regards.
WR.

19
Tutorials / [TUT] Making a "boolean" (tinyint 1) field searchable
« on: August 04, 2005, 02:31:50 AM »
NOTE: I was wanting to post this on the mods section, but I don't know why I don't have permission to post there. If some admin wants to move the post, I will be grateful

Hello people:

There is a problem if you want to add a boolean field and make it searchable using this guide:
http://www.4homepages.de/forum/index.php?topic=1313.0

That works very well with varchar fields. But for boolean fields, it's actually a waste of time and space, because to index it you have to set MIN_SEARCH_KEYWORD_LENGTH to 1, what causes to almost ALL words to be indexed. That can be a problem if you have various searchable fields, as I have. And in case that you want to find a positive value you have to enter a 1 in the search terms...

This mod allows you to make a boolean field searcheable WITHOUT indexing it. It works almost in the same way wich search_new_images works.
I will show the example with the field "image_nocturnal", but thats your choice.

First, add a "boolean" (tinyint 1) field to the images table, with this tutorial:
If you are goin to use an "internal" field (as this example, there is no need to show "Nocturnal: Yes" in the details page) you can avoid the steps involving details.html .

http://www.4homepages.de/forum/index.php?topic=747.msg3277#msg3277

In file search.php :
Look for:
Code: [Select]
if (isset($HTTP_POST_VARS['search_new_images']) || isset($HTTP_GET_VARS['search_new_images'])) {
  $search_new_images = 1;
  $show_result = 1;
}
else {
  $search_new_images = 0;
}

Insert below :
Code: [Select]
// NOCTURNAS
if (isset($HTTP_POST_VARS['search_nocturnal_images']) || isset($HTTP_GET_VARS['search_nocturnal_images'])) {
  $search_nocturnal_images = 1;
  $show_result = 1;
}
else {
  $search_nocturnal_images = 0;
}
//FIN NOCTURNAS

find:
Code: [Select]
if ($search_new_images && $show_result == 1) {
  $search_id['search_new_images'] = 1;
}

insert below:
Code: [Select]
//NOCTURNAS
if ($search_nocturnal_images && $show_result == 1) {
  $search_id['search_nocturnal_images'] = 1;
}
//FIN NOCTURNAS

find:
Code: [Select]
  if (!empty($search_id['search_new_images']) && $search_id['search_new_images'] == 1) {
    $new_cutoff = time() - 60 * 60 * 24 * $config['new_cutoff'];
    $sql_where_query .= "AND i.image_date >= $new_cutoff ";
  }

add below:
Code: [Select]
// NOCTURNAS
  if (!empty($search_id['search_nocturnal_images']) && $search_id['search_nocturnal_images'] == 1) {
    $sql_where_query .= "AND i.image_nocturnal = 1 ";
  }
// FIN NOCTURNAS

find:
Code: [Select]
  $site_template->register_vars(array(
    "search_keywords" => htmlspecialchars(stripslashes($org_search_keywords)),
    "search_user" => htmlspecialchars(stripslashes($org_search_user)),
    "lang_search_by_keyword" => $lang['search_by_keyword'],
    "lang_search_by_username" => $lang['search_by_username'],
    "lang_new_images_only" => $lang['new_images_only'],
    "lang_search_terms" => $lang['search_terms'],
    "lang_or" => $lang['or'],
    "lang_and" => $lang['and'],
    "lang_category" => $lang['category'],
    "lang_search_fields" => $lang['search_fields'],
    "lang_all_fields" => $lang['all_fields'],
    "lang_name_only" => $lang['name_only'],
    "lang_description_only" => $lang['description_only'],
    "lang_keywords_only" => $lang['keywords_only'],
    "category_dropdown" => get_category_dropdown($cat_id),

add below
(note the comma on the previous line)
Code: [Select]
    "category_dropdown" => get_category_dropdown($cat_id),
// NOCTURNAS
    "lang_nocturnal_images_only" => $lang['nocturnal_images_only']
// FIN NOCTURNAS

Now in page_header.php :

Find:
Code: [Select]
  "url_new_images" => $site_sess->url(ROOT_PATH."search.php?search_new_images=1"),
Add below :
Code: [Select]
// NOCTURNAS
  "url_nocturnal_images" => $site_sess->url(ROOT_PATH."search.php?search_nocturnal_images=1"),
// FIN NOCTURNAS

Now go to main.php of your language directory, and define (before ?> or in any place that you want):

Code: [Select]
$lang['nocturnal_images_only'] = "Sólo imágenes nocturnas";
("Sólo imágenes nocturnas" = "Only nocturnal images" in english).

Now you can add in your template pages the following code:

In search_form.html, the checkbox to limit the search to the images that have a positive value on the field "image_nocturnal":
Code: [Select]
<input type="checkbox" name="search_nocturnal_images" value="1" /> {lang_nocturnal_images_only}
And the link to show directly all the images with a positive value (on any page of your template):
Code: [Select]
<a href="{url_nocturnal_images}">
In case that someone ask:

If you want to look for non-positive (zero) values in the field too, you can put a second instance of the mod (just below the new code added), and change the variable, function and tag names, and replace:
Code: [Select]
$sql_where_query .= "AND i.image_nocturnal = 1 ";
with:
Code: [Select]
$sql_where_query .= "AND i.image_nocturnal = 0 ";
Well, that's it...
Best regards.
WR.

20
Tutorials / Re: [Tutorial] Making additional field searchable
« on: August 01, 2005, 03:39:17 AM »
Hello.

First and mainly, thanks for this mod. Its really very helpful to my purposes (site on-line soon...).

And, a question:

I'm adding a boolean field. And I want to make it searchable. The question is: I have to add a new column -with the field's name- to the wordmach table?.

And, if somebody wants to add a boolean field, here is the format for the member_uploadform.html (replace "nocturnal" with the name of your choice...):

Code: [Select]
          <tr>
           <td class="row2" valign="top"><b>{lang_image_nocturnal}</b></td>
   <td class="row2"> <input type="radio" name="image_nocturnal" value="1"> {lang_yes}&nbsp;&nbsp;&nbsp;<input type="radio" name="image_nocturnal" value="0" checked="checked"> {lang_no} </p></td>
          </tr>

Thanks in advance.

Best Regards.
WR.

21
Gracias a quien haya puesto a disposición este MOD, me ayudó a resolver este problema :) :D

Gracias por tu ayuda
Saludos de Hernán

He did just say:

"Thanks to who has released this mod, It did help me to solve this problem.
thanks for your help.
Greetings from Hernán".

I think that he has a little confusion... it's a bugfix, not a mod...

Quote from: Chris
That's all I remember from 3 years of high school spanish.


hehehe spanish is my first language, and my english is of 5 years of secondary school... :lol:

Best regards.
WR.

22
exactamente para que es este mod?? no entiendo....

Si te referís a mi primer post, no es más que una traducción del mod original (annotate), que se puede bajar de la zona de mods de este foro.
Y si preguntás por el annotate en sí, permite incrustar una marca de agua -ya sea de texto o de imagen- sobre las imágenes que se suben  a la galería.
Es decir: permite que al subir una imagen, le quede incrustado un texto a la misma, ya sea un texto estático, o el nombre de usuario, fecha, etc. (las variables con las que tenía problemas).
También permite incrustarles una imagen, que puede ser el logo del sitio o lo que quieras (en formato PNG).
Yo lo combiné con el mod de auto-rezise y me ahorra mucho trabajo (o bueno, me ahorrará cuando la galería esté on line), ya que puedo subir una imagen en bruto (es decir, tal y como la bajo de mi cámara digital) y la propia galería le da el tamaño estándar, y a su vez agrega los datos de copyright.

Slds.
WR.

23
Bueno, ya lo solucioné.

Pueden fijarse la solución acá:

http://www.4homepages.de/forum/index.php?topic=3808.msg42236#msg42236

Slds.
WR.

24
Hello again people:

I did find my error (or may be script error?).

Look at the file includes/annotate.php of the mod, line 74...

Code: [Select]
$ann_vars = array ("'%D'", "'%T'", "'%N'", "'%H'", "'%U'", "'%S'", "'%B'");
Do you see something strange?. Yep... double AND simple quotes. So the array was being filled with the '%X' string (all the text between the double quotes) instead of being filled with the expected string (or at least what I was expecting).
So you have two options: using the variables inside the simple quotes on the options page of the annotate (in case that you will use %<any of the posible letters used> just as srting), or simply editing this line and remove the simple quotes, so it looks like this:

Code: [Select]
$ann_vars = array ("%D", "%T", "%N", "%H", "%U", "%S", "%B");
Thanks for this excellent mod, it is just what I need.

Best regards.
WR.

25
Saludos,,,

Cambia ,, en vez de poner las variables,,, pon el texto que quieres que salga.  :twisted: :twisted:

excitex2

jejeje. Pero la gracia es que yo no soy el único que va a subir imágenes. La idea es que, dependiendo de el user, el annotate ponga en cada foto: © %S - %N . Lo que sería igual a © Juan Perez - Galeria XXX .Supongamos que el sitio lo pueda poner directamente, después de todo eso no cambia. Pero lo que más me interesa es el tema del usuario...
Gracias de todas maneras.

Slds.
WR.

26
Hola gente:

Bueno resulta que los mods estan bien aplicados, sucede que al subir imágenes desde la página del admin los mismos nos funcionan. Tengo que dirigirme a la categoría y darle al botón "upload" de la parte superior derecha.
Sigo teniendo el problema con el annotate: funciona bien ahora -al subir la imagen-, pero resulta que sigue sin imprimir las variables como corresponde: simplemente escribe %S y %N . ¿alguno tiene idea?.

Slds.
WR.

27
Well, I did try it again, and It works when uploading images, but still cannot make the variables work...

Any idea?.

Best regards.
WR.

28
Hello.

It works, only in part. It doesn't work automatically when uploading images. I have to do it manually, via Batch Annotate. The other problem (worse) is that I can't use the variables %S and %N . Instead of inserting the data (user name and site name), it just prints the string exactly like that... %S and %N. I enabled the detailed error messages of PHP (I'm just trying on my computer), and it says as "notice": $user_info isn't declared on line 72 file: /includes/annotate.php .
No error for line 71,
Code: [Select]
($ann_site_name = $config['site_name'];) wich is the definition of the other variable that I'm using.

Anybody with the same problem?.

Best regards.
WR.

29
Hola gente.

Bueno soy nuevo por acá, más que nada porque estoy armando un sitio de fotografías y 4images me pareció la mejor opción.
La verdad me estoy volviendo loco con los mods...
Antes de preguntar, les dejo mi primera contribución:

Traduje el annotation mod al español, simplemente deben agregar lo que aquí les paso a \lang\spanish\admin.php

Code: [Select]
//-----------------------------------------------------
//--- Annotation Settings -----------------------------
//-----------------------------------------------------

$lang['nav_ann_settings'] = "Configuración de Annotation";
$lang['nav_ann_current_conv_tool'] = "actualmente está configurado como herramienta de conversión de imágenes";
$setting['annotation_use'] = "Utilizar nota automática de imágenes al subir imágenes.";
$setting['annotation_mode'] = "Modo de Nota<br /><span class=\"smalltext\">Seleccione si usar una nota de texto o de imagen</span>";
$annotation_mode_optionlist = array(
  "text"  => "texto",
  "image" => "imagen"
);
$setting['annotation_embed_image'] = "Imagen a incustar<br /><span class=\"smalltext\">Especifique la ruta completa y nombre de archivo de la imagen PNG</span>";
$setting['annotation_embed_image_opacity'] = "Opacidad de la imagen a insertar<br /><span class=\"smalltext\">Valor entre 0 y 100.</span>";
$setting['annotation_embed_image_bg'] = "Color de fondo de la imagen a insertar que se toma como transparencia<br /><span class=\"smalltext\">Defina un valor hexadecimal, por ejemplo: #000000. <a target=\"_blank\" href=\"color.html\">Ejemplos de colores</a></span>";
$setting['annotation_font'] = "Fuente (tipografía) de la nota &nbsp;&nbsp;<span class=\"smalltext\"><br>Especifique la ruta completa y nombre de archivo de fuente.<br>Para ImageMagick & librería GD: <b>TTF para Windows</b> solamente, para NetPBM: fuentes de formato <b>X-Windows BDF</b> solamente!</span>";
$setting['annotation_font_size'] = "Tamaño de la fuente";
$setting['annotation_use_shadow'] = "Usar sombras";
$setting['annotation_shadow_offset'] = "Desplazamiento de la sombra (el mismo a la derecha y abajo)";
$setting['annotation_image_quality'] = "Calidad de la imagen resultante: (en porcentaje)";
$setting['annotation_text'] = "Texto a incrustar <br /><span class=\"smalltext\">Las siguientes variables son válidas: <b>%N</b> - Nombre del sitio, <b>%H</b> - URL completa, <b>%U</b> - URL corta, <b>%S</b> - Nombre de usuario, <b>%D</b> - fecha, <b>%T</b> - hora, <b>%B</b> - baja una línea</span>";
$setting['annotation_fill_color'] = "Color de relleno del texto<br /><span class=\"smalltext\">Defina un valor hexadecimal, por ejemplo #FFFFFF. <a target=\"_blank\" href=\"color.html\">Ejemplos de colores en HEX</a></span>";
$setting['annotation_shadow_color'] = "Color de la sombra del texto <br /><span class=\"smalltext\">Defina un valor hexadecimal, por ejemplo,  #000000. <a target=\"_blank\" href=\"color.html\">Ejemplos de colores en HEX</a></span>";
$setting['annotation_fill_alpha'] = "Nivel de transparencia del color de relleno (alpha blending)<br /><span class=\"smalltext\">El valor de mezcla alpha debe estar entre 0.0 y 0.9&nbsp;&nbsp;&nbsp;&nbsp;0.0 = sin transparencia (sólido)</span>";
$annotation_fill_alpha_optionlist = array(
  "0.0"  => "0.0",
  "0.1"  => "0.1",
  "0.2"  => "0.2",
  "0.3"  => "0.3",
  "0.4"  => "0.4",
  "0.5"  => "0.5",
  "0.6"  => "0.6",
  "0.7"  => "0.7",
  "0.8"  => "0.8",
  "0.9"  => "0.9",
);
$setting['annotation_shadow_alpha'] = "Nivel de transparencia del relleno de la sombra (alpha blending)<br /><span class=\"smalltext\">El valos de mezcla alpha debe estar entre 0.0 y 0.9&nbsp;&nbsp;&nbsp;&nbsp;0.0 = sin transparencia (sólido)</span>";
$annotation_shadow_alpha_optionlist = array(
  "0.0"  => "0.0",
  "0.1"  => "0.1",
  "0.2"  => "0.2",
  "0.3"  => "0.3",
  "0.4"  => "0.4",
  "0.5"  => "0.5",
  "0.6"  => "0.6",
  "0.7"  => "0.7",
  "0.8"  => "0.8",
  "0.9"  => "0.9",
);
$setting['annotation_v_alignment'] = "Alineación vertical";
$setting['annotation_h_alignment'] = "Alineación horizontal";
$annotation_v_positioning_optionlist = array(
  "top"  => "por encima",
  "middle" => "al medio",
  "bottom" => "debajo"
);
$annotation_h_positioning_optionlist = array(
  "left"  => "borde izquierdo",
  "center"  => "centro",
  "right" => "borde derecho"
);
$setting['annotation_top_offset'] = "Margen superior";
$setting['annotation_bottom_offset'] = "Margen inferior";
$setting['annotation_left_offset'] = "Margen izquierdo";
$setting['annotation_right_offset'] = "Margen derecho";
?>

Y ahora sí, las preguntas:
Estoy probando todos los mods en mi PC antes de subir todo al hosting. Estoy armando, en un directorio aparte, un 4images con todos los mods instalados, de manera que una vez que suba los archivos al hosting "real", simplemente tenga que ejecutar la instalación del 4images, y luego la de cada mod. (en mi caso estoy probando con el auto-resize y el annotation, y tengo planeado agregar el exif).
Lo que sucede es que, en el caso del annotate, funciona perfecto el plug in (batch annotate), sin embargo no logro hacer que funcionen los tags (he probado %S y %N , que son los que usaré principalmente), en lugar de imprimir el dato simplemente implime las cadenas, como si la variable no estuviese definida. Tampoco pude lograr que incruste las notas al subir nuevas imágenes. Estoy muy seguro de que segui los pasos de instalación al pie de la letra.
Y el auto rezise tampoco funciona. Las opciones aparecen correctamente en el panel, pero no hay caso.

Alguno tiene alguna ayuda? es preferible hacer una instalación tradicional del 4 images y luego agregar los mods manualmente en el host?.

Saludos.
WR.

Pages: 1 [2]