elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Introducción a la Factorización De Semiprimos (RSA)


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP)
| | | |-+  Programación Visual Basic (Moderadores: LeandroA, seba123neo)
| | | | |-+  presentacion de imagenes con Auto-viewer
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: presentacion de imagenes con Auto-viewer  (Leído 2,072 veces)
‭‭‭‭jackl007


Desconectado Desconectado

Mensajes: 1.403


[UserRPL]


Ver Perfil WWW
presentacion de imagenes con Auto-viewer
« en: 6 Septiembre 2008, 19:25 pm »

Bueno, queriendo hacer una presentacion de imagenes, me encontre con un proyecto muy simpatico, y le agrege un programita para pre-configurar parte de las imagenes que se mostraran en el, ya que hacerlas manualmente son molestosas, aun mas cuando las imagenes son de distintas resoluciones.

aqui esta la url del proyecto del Autoviewer:
http://www.airtightinteractive.com/projects/autoviewer/

bajamos el paquete del autoviewer (necesario para poder hacer la presentacion):
http://www.airtightinteractive.com/projects/autoviewer/autoviewer.zip
y ya tenemos los archivos necesarios, para lo nuestro.

ejemplo:
http://usuarios.lycos.es/jkbenites29/Auto-viewer



ahora lo mio, abrimos un proyecto y colocamos estos controles como en la imagen:

damos las propiedades al control text2 necesarias: multiline, y bars

Código
  1. Private Declare Function GetObject _
  2.    Lib "gdi32" _
  3.    Alias "GetObjectA" ( _
  4.        ByVal hObject As Long, _
  5.        ByVal nCount As Long, _
  6.        lpObject As Any) As Long
  7.  
  8. 'Estructutra necesesaria para la informacion del Bitmap
  9. Private Type BITMAP
  10.    bmType As Long
  11.    bmWidth As Long
  12.    bmHeight As Long
  13.    bmWidthBytes As Long
  14.    bmPlanes As Integer
  15.    bmBitsPixel As Integer
  16.    bmBits As Long
  17. End Type
  18.  
  19. 'Array de bytes y variable para la estructura
  20. Dim PicBits() As Byte, PicInfo As BITMAP
  21.  
  22. Dim ArchivoXML As String
  23. Dim MAX As Integer
  24. 'Variable para almacenar la imagen
  25. Dim Laimagen As IPictureDisp
  26. Function Nombre(path)
  27. Nombre = Mid(path, InStrRev(path, "\") + 1)
  28. End Function
  29. Function Factor(ByVal num As Double)
  30. Dim N As Integer
  31. N = Round(num)
  32.  
  33. If N < 680 Then
  34. Factor = 1
  35. Else
  36.  
  37.    Dim temp As Double
  38.    temp = N / MAX
  39.    If temp > 1 Then
  40.    Factor = N / temp
  41.    Else
  42.    Factor = N
  43.    End If
  44.  
  45.    Factor = Round(temp, 4)
  46. End If
  47.  
  48. End Function
  49. Function Div(numW, numH)
  50. Dim N As Integer
  51.  
  52. N = numW: MAX = 680
  53. If numW < numH Then
  54. N = numH
  55. MAX = 500
  56. End If
  57.  
  58.  
  59. Dim temp As Double
  60. temp = Factor(N)
  61.  
  62. numW = Round(numW / temp)
  63. numH = Round(numH / temp)
  64. 'If MAX = 500 Then numH = numH - 100
  65.  
  66. Dim Adicional As Integer
  67. Adicional = 450 - numH
  68.  
  69.  
  70. If Adicional > 0 Then
  71.  
  72. If numH > 350 Then
  73. numW = Round((numW * (numH + Adicional)) / numH)
  74. numH = numH + Adicional
  75.  
  76. End If
  77. End If
  78.  
  79. End Function
  80.  
  81. Function Subfolders(path)
  82.    On Error Resume Next
  83.  
  84.    Set fso = CreateObject("Scripting.FileSystemObject")
  85.    Dim N_w, N_h As Integer
  86.  
  87.    Set Drives = fso.Drives
  88.    newpath = path
  89.    Set Fold = fso.GetFolder(newpath)
  90.    Set Files = Fold.Files
  91.  
  92.    For Each File In Files
  93.  
  94.    Set Laimagen = LoadPicture(File.path)
  95.    GetObject Laimagen, Len(PicInfo), PicInfo
  96.  
  97.        ext = fso.GetExtensionName(File.path)
  98.        ext = LCase(ext)
  99.        If ext = "jpg" Then
  100.       N_w = CLng(PicInfo.bmWidth)
  101.       N_h = CLng(PicInfo.bmHeight)
  102.       test = Div(N_w, N_h)
  103.  
  104.    ArchivoXML = ArchivoXML & vbCrLf & "<image>" & vbCrLf _
  105.                & "     <url>" & Nombre(Text1) & "/" & File.Name & "</url>" & vbCrLf _
  106.                & "     <caption> </caption>" & vbCrLf _
  107.                & "     <width>" & N_w & "</width>" & vbCrLf _
  108.                & "     <height>" & N_h & "</height>" & vbCrLf _
  109.                & "</image>" & vbCrLf
  110.  
  111.                '& "     <width>" & CLng(PicInfo.bmWidth) / 2.4 & "</width>" & vbCrLf
  112.                '& "     <height>" & CLng(PicInfo.bmHeight) / 2.4 & "</height>" & vbCrLf
  113.  
  114.                End If
  115.                DoEvents
  116.    Next
  117.  
  118. End Function
  119.  
  120. Private Sub Command1_Click()
  121.  
  122.  
  123. ArchivoXML = "<?xml version=" & Chr(34) & "1.0" & Chr(34) & " encoding=" & Chr(34) & "UTF-8" & Chr(34) & "?>" & vbCrLf _
  124.            & "<gallery frameColor=" & Chr(34) & "0xFFFFFF" & Chr(34) & " frameWidth=" & Chr(34) & "15" & Chr(34) & " imagePadding=" & Chr(34) & "20" & Chr(34) & " displayTime=" & Chr(34) & "6" & Chr(34) & " enableRightClickOpen=" & Chr(34) & "true" & Chr(34) & ">" & vbCrLf & vbCrLf
  125.  
  126. Subfolders (Text1.Text)
  127.  
  128. ArchivoXML = ArchivoXML & vbCrLf & "</gallery>"
  129. Text3.Text = ArchivoXML
  130. End Sub
  131.  

Algunas cositas encontre en la web como la forma de obtener la resolucion de una imagen ...

en el text1 se coloca la ruta de las imagenes, y el programa genera el archivo tratando de acomodar la resolucion de las imagenes a una adecuada, por ejemplo, si se colocan imagenes grandes, el programa encuentra el tamaño apropiado en el archivo.
y ahora tendremos el texto del archivo gallery.xml completo, listo para agregar al proyecto.

esto lo hice, porque me daba pereza ponerme a agregar la configuracion de las imagenes manualmente, asi que mejor un programa que lo haga por mi.

ahora agregamos el archivo gallery.xml afuera de la carpeta que contiene las imagenes (salvo que edites el programa, para que lo coloques a tu gusto).

ahora les dejo un ejemplo:
http://usuarios.lycos.es/jkbenites29/Auto-viewer

(las imagenes las tome yo con mi camara, aqui dejo la url del correspondiente post:
http://foro.elhacker.net/fotografia/fotitos_jaen_peru_with_autoviewer-t224361.0.html



En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Evitar detección uso comercial en Team Viewer
Software
Ganejash 2 22,783 Último mensaje 6 Septiembre 2011, 00:49 am
por worm91
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines