come posso far comunicare i due script?
Il primo, in php, con appositi css crea una galleria d'immagini con un box di miniature e un box con l'ingrandimento della foto selezionata.
codice:
function VISUAL_FOTO() {?>
<div id="container">
<div id="header"><h3>LA GALLERIA FOTOGRAFICA</h3></div>
<div id="gallery">
<div id="minipics">
<ul><?
$photo_dir="images/photo";
$thumb_dir="images/thumb";
if ($dh=opendir($photo_dir)) {
while ($file=readdir($dh)) {
$photo=$photo_dir."/".$file;
if (is_file($photo)) {
$info=getimagesize($photo);
if ($info[2]==2) { # flag che se uguale a 2 indica che il file ha estensione JPG
# info[0]=larghezza info[1]=altezza
$thumb=$thumb_dir."/".str_replace(".JPG","t.JPG",$file);
echo "[*][img]$thumb[/img]";
}
}
}
closedir($dh);
}?>[/list]
</div>
<div id="zoom"><h3 id="titolo">Clicca sulle miniature per vedere gli ingrandimenti.</h3>
[img]empty.jpg[/img]
</div>
</div>
</div><?
}
Il secondo, in asp.net, che crea una miniatura di un'immagine (occorre anche trovare un modo per comunicare allo script i percorsi dell'immagine "sour" e dell'anteprima "dest")
codice:
<html>
<head>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Imaging" %>
<%@ Page Language="VB" Debug="true" %>
<script language="VB" runat=server>
Function NewthumbSize(currentwidth, currentheight)
' Calculate the Size of the New image
dim x,y,h,w as Double
x=currentwidth
y=currentheight
h=Request.QueryString("h")
w=Request.QueryString("w")
if (x>y) then
x=w
y=(w*y)/x
else
x=(h*x)/y
y=h
end if
dim NewSize as New Size(x, y)
return NewSize
End Function
Sub Page_Load(Sender As Object, E As EventArgs)
dim objBMP as System.Drawing.Bitmap
dim objGraphics as System.Drawing.Image
dim path_from as String
path_from=Request.QueryString("sour")
path_to=Request.QueryString("dest")
objBMP = New Bitmap(path_from)
dim thumbSize as New size
thumbSize=NewthumbSize(objBMP.width,objBMP.height)
objGraphics = objBMP.GetThumbnailImage(thumbsize.width, thumbsize.height, Nothing, IntPtr.Zero)
objGraphics.Save(Server.MapPath(path_to), ImageFormat.JPEG)
End Sub
</script>
</head>
<body Runat="server">
<asp:Image ID="objGraphics" Src="" Runat="server" />
</body>
</html>
La relazione dovrebbe essere questa:
codice:
resize.aspx?w=120&h=120&sour=$photo&dest=$thumb
per ogni immagine da selezionare per l'ingrandimento!
P.S.: se qualche moderatore ritiene che io possa ricevere maggiore aiuto nella sezione riguardante ASP.NET o VISUAL BASIC, e visto che non è possibile clonare discussioni su altri forum lo prego di spostare questa discussione.