[Geomoose-users] Open an Image

Jay Kapalczynski jkapalczynski at ci.maple-grove.mn.us
Mon Dec 29 11:11:06 EST 2008


Sorry didn't respond to everyone....

Thanks for the help and thoughts....

From: Jay Kapalczynski
Sent: Monday, December 29, 2008 10:07 AM
To: 'Dan Little'
Subject: RE: [Geomoose-users] Open an Image

I am using php page but maybe not the correct way...I am not using a shapefile to find the images due to the fact that there may be many images per location.
I am querying a database to find image names...
Currently this is an internal application, but understand what you are saying about giving the full path.  My next steps are to learn more about securing the site for outside viewers....so you are saying that the URL will be showing me the location....by doing it your way I will be masking the URL path....is that correct...

I am a bit confused because I think you were assuming that I was using a shapefile for the image names.  I do not think that applies to how I am doing this....see below..

Any thoughts would be appreciated.



THIS IS THE BUTTON THAT THE USER HITS TO RUN THE QUERY
<tr>
<td align="center" width='100'>Both SQL and Access:</td>
<td style= "cursor:pointer" align="center" onclick="javascript:getResulthype('parcellink3.php','[PID]','S')"><font size='2' color='#007FFF' >Open Images</font></td>
</tr>


THIS IS AN ajax page that is called above with "getResulthype"

function getResulthype(page,id,type){

    var _target = 'content_details_form';

    if (id.length == 0) {
        document.getElementById(_target).innerHTML="<b>No Information Available</b>";
        return;
    }
    xmlHttp = GetAJAXObject();
    if (xmlHttp==null) {
        alert ("Unable to process your request, your browser does not support AJAX!");
        return;
    }
    var url = "http://127.0.0.1:80/geomoose/php/"+page+"?id="+id+"&type="+type;

    xmlHttp.onreadystatechange = showResult;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}


THIS IS THE PHP Page to run the query "parcellink3.php"

<?php

require("FuncDef.php");
?>

    $sql_str2 = "SELECT * FROM PHOTOS WHERE PID = '".$p_num."' AND Photo_Doc = 'S'";
    $photo_rs2 = $conn->execute($sql_str2);
                echo "<br>";
    echo "<div class='redbg'> <b><big>Assessing Sketches:</big></b></div>";
    echo "<br>";
    If ($photo_rs2->EOF)
                {
        echo "No photos exist for this parcel!";
    } else
                {
        $photo_rs2->MoveFirst();
        echo "<table border='2' width='100%'>";
        While (!$photo_rs2->EOF)
        {
            $p_name2 = $photo_rs2->Fields("Filename")->Value;

                             $p_hype2 = "javascript:window.open('file://C:/ms4w/apps/GeoMOOSE/htdocs/pdf/Assessing_Sketches/".$p_name2."','photowindow','width=450,height=350')";

                                writelinewhype($p_name2,"Image",$p_hype2);

                                                $photo_rs2->MoveNext();
        }
        echo "</table>";
        $photo_rs2->Close();
        $photo_rs2 = null;
     }



THIS IS THE FuncDef.php

<?php

function writelinewhype($p_obj,$p_name,$hypelink) {
  echo "<tr>";
  echo "<td style= 'text-align:center' width = '100'><font size='1'>".$p_name."</font></td>";
  echo "<td style= 'cursor:pointer' align='center' onClick =".$hypelink."><font size='1' color='#007FFF'>".$p_obj."</font></td>";
  echo "</tr>";
}

?>

From: Dan Little [mailto:danlittle at yahoo.com]
Sent: Monday, December 29, 2008 9:39 AM
To: Jay Kapalczynski; geomoose-developers at lists.sourceforge.net; geomoose-users at lists.sourceforge.net
Subject: Re: [Geomoose-users] Open an Image

Jay,

This type of request is really, really, really bad practice:
1) It shows the full path to the storage of all of your images.
2) That path is relative to the computer you are USING not the computer where you have the images stored.

You should really have a PHP script like the following (put it in the htdocs/php folder and name it "getSketch.php" or something intuitive):

<?php

$sketchName = $_REQUEST['sketch_name'];

header('Content-type: application/pdf');
readfile('c:/ms4w/apps/GeoMOOSE/htdocs/pdf/Assessing_Sketches/'.sketchName);
?>

And the hyperlink should look like this... (assuming [SKETCHNAME] is the field containing the unique ID in a mapserver template file of some sort).

<a href="php/getSketch.php?sketch_name=[SKETCHNAME]" target="photowindow">View Sketch PDF</a>

Or if you must use the javascript windows...

<a href="javascript:window.open('php/getSketch.php?sketch_name=[SKETCHNAME]', 'photowindow', 'width=450,height=350')"> View Sketch PDF</a>

________________________________
From: Jay Kapalczynski <jkapalczynski at ci.maple-grove.mn.us>
To: "geomoose-developers at lists.sourceforge.net" <geomoose-developers at lists.sourceforge.net>; "geomoose-users at lists.sourceforge.net" <geomoose-users at lists.sourceforge.net>
Sent: Monday, December 29, 2008 9:27:09 AM
Subject: [Geomoose-users] Open an Image
I am having a problem here...
I have two different locations where I am storing my imagery. As seen below with the two different paths.
I verified that the image is present in both locations, and that the path names are correct....but for some reason I cannot get the image in the C drive to open.  The image located in the S drive opens fine.
Can anyone see why that may be....is there some sort of syntax issue with storing the files within the ms4w folder?

Not working
$p_hype2 = "javascript:window.open('file://C:/ms4w/apps/GeoMOOSE/htdocs/pdf/Assessing_Sketches/".$p_name2."','photowindow','width=450,height=350')";

Working
$p_hype2 = "javascript:window.open('file://S:/GeoImag/Assessing/Sketches/".$p_name2."','photowindow','width=450,height=350')";




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/geomoose-users/attachments/20081229/f4870d8e/attachment.html


More information about the Geomoose-users mailing list