Spry:if image file exists?

Hi,
is there a easy way to test if an image file exists on the server? I try to generate dynamic html listing names and pictures. The names (and other info) arein a xml file. For some, images exist on the server as name.jpg file. I'd like to check with spry if name.jpg file exist and if take it as picture, if not use a general placeholder.
thanks for any hlep,
thorsten

Hi Ben,
thanks for your time and effort helping. I'd really appreciate this.
How is the XML-file compiled eg from a database or coded by hand
          I use both on my web site and It would be nice if the solution would work both
               - with a query send to our institutes phone book. Results are in xml format
               - and a local xml file, that has been edited by hand.
Is there a serverside program you use eg PHP, ASP, Coldfusion
          I can use PHP or javascript, but php does not work in combination with server-side-includes that we use on our apache web server. I'd prefer javascript, because those script run on any page, even if SSI is used.
Have you considered using an HTML table to retrieve the info instead of using XML
          No yet, because also the local xml file is basically identical to the query output. I just add some fields manually to the local xml file. (So I could add a "picture" entry, but this solution would not work with the xml online query).
Is there anywhere where I can view your code
          The page is already online, the goal is to eliminate the non-existing picture links. This page queries a local xml file
          http://lch.web.psi.ch/webcontent/EduTeach/students.html
          I did a similiar thing using php on other pages of the site. This page queries a phonebook database using the xml output. It is written in php, which does not work with our server when SSI is used. The workaround is to include a html page generated by a php scirpt using iframe. I'd really would love to replace this php script by a spry/javascirpt combination.
          http://lch.web.psi.ch/webcontent/research/surface/Gruppe.html
I attach the html file and php file for the two pages. Thanks, best, t.

Similar Messages

  • How to test if a image file exists???

    Hi ppl,
    heres my problem...im using servlets and jsp and i only ever want to access the jsp file from a redirect in the servlet. Problem arises however if the user trys to access the jsp file directly in which case all the relative links on the page are no longer in the same context as if they were accessed via the servlet.
    i wanna have some kind of test on my jsp page which displays an error page if the user has access the page directly but im not sure the best way to go about this.
    i was thinkin about tryin to determine if an image file exists using a relative link...in which case if the relative links where off then it wouldnt.
    Any suggestions on the best way to do this...or if there might be a better way to test such a case?
    any advice much appreaciated.
    Mycall

    I would suggest moving all jsp's that you dont want the user to have direct access to under the WEB-INF directory. This way they would only be able to access it through your servlet.
    Hope this helps

  • How to test an image file existing or not

    Hi Everyone,
    I want to test whether an image file exists or not before setting the url of an image component in JSF to it. Following is my code:
    File testFile = new File(image_path + "/p1.jpg");
    if(testFile.exists()){
    info("file exists");
    }else{
    info("file not exists");
    this.myImage.setUrl(image_path+"/p1.jpg");
    Althoug the p1.jpg can be linked to myImage, the existence test always fails. That is, I got the message "file not exists" even though it is already displayed.
    What did I do wrong?
    Thanks in advance,
    Message was edited by:
    field

    File testFile = new File(image_path + "/p1.jpg");Is image_path an absolute path or relative path?

  • How to Check Images File Exist? in different server

    Hi,
    I have 10 different coldfusion server.
    for example 9 server is for the web application site - for
    example
    http://myserverone/studentweb
    the other one is for images website, just for displaying
    student picture - for example
    http://myserverimage/studentpicture.
    the purpose of this website is to display student picture
    that i store as gif files.
    from my studentweb website i will call the images from
    studentpicture website as source for my image placeholder.
    for example this is my code i'm calling form
    http://myserverone/studentweb
    website:
    <img src="
    http://myserverimage/studentpicture/#studentnumber#.gif"
    alt="" name="studentpicture" width="160" height="200">
    my problem is, if there is no specific student picture in my
    studentpicture website, then the placeholder will display an X (
    mean the images not found )
    how do i prevent the X to display?
    how do i using coldfusion or any kind of way to check if the
    images exist on that website ( different server ), so if the images
    is not found, i can display a default images? i can do this if i'm
    calling the website in the same server, but not using a different
    server.
    this is like using other website images for your own personal
    website and sometimes the owner delete the images from their
    website, and i want to display my own images if that images been
    removed from the source website.
    anyone have done this before?
    thanks for suggestion and guide...
    haire

    1. Use CFHTTP with method="HEAD".
    2. See, if the HTTP status code is 200.
    The head-method is of course more efficient, as it doesn't
    need to "get" the message body. However, a status code of 200 is
    possible even when the requested image file is no longer on the
    server.

  • If image file not exist in image path crystal report not open and give me exception error problem

    Hi guys my code below show pictures for all employees
    code is working but i have proplem
    if image not exist in path
    crystal report not open and give me exception error image file not exist in path
    although the employee no found in database but if image not exist in path when loop crystal report will not open
    how to ignore image files not exist in path and open report this is actually what i need
    my code below as following
    DataTable dt = new DataTable();
    string connString = "data source=192.168.1.105; initial catalog=hrdata;uid=sa; password=1234";
    using (SqlConnection con = new SqlConnection(connString))
    con.Open();
    SqlCommand cmd = new SqlCommand("ViewEmployeeNoRall", con);
    cmd.CommandType = CommandType.StoredProcedure;
    SqlDataAdapter da = new SqlDataAdapter();
    da.SelectCommand = cmd;
    da.Fill(dt);
    foreach (DataRow dr in dt.Rows)
    FileStream fs = null;
    fs = new FileStream("\\\\192.168.1.105\\Personal Pictures\\" + dr[0] + ".jpg", FileMode.Open);
    BinaryReader br = new BinaryReader(fs);
    byte[] imgbyte = new byte[fs.Length + 1];
    imgbyte = br.ReadBytes(Convert.ToInt32((fs.Length)));
    dr["Image"] = imgbyte;
    fs.Dispose();
    ReportDocument objRpt = new Reports.CrystalReportData2();
    objRpt.SetDataSource(dt);
    crystalReportViewer1.ReportSource = objRpt;
    crystalReportViewer1.Refresh();
    and exception error as below

    First: I created a New Column ("Image") in a datatable of the dataset and change the DataType to System.Byte()
    Second : Drag And drop this image Filed Where I want.
    private void LoadReport()
    frmCheckWeigher rpt = new frmCheckWeigher();
    CryRe_DailyBatch report = new CryRe_DailyBatch();
    DataSet1TableAdapters.DataTable_DailyBatch1TableAdapter ta = new CheckWeigherReportViewer.DataSet1TableAdapters.DataTable_DailyBatch1TableAdapter();
    DataSet1.DataTable_DailyBatch1DataTable table = ta.GetData(clsLogs.strStartDate_rpt, clsLogs.strBatchno_Rpt, clsLogs.cmdeviceid); // Data from Database
    DataTable dt = GetImageRow(table, "Footer.Jpg");
    report.SetDataSource(dt);
    crv1.ReportSource = report;
    crv1.Refresh();
    By this Function I merge My Image data into dataTable
    private DataTable GetImageRow(DataTable dt, string ImageName)
    try
    FileStream fs;
    BinaryReader br;
    if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + ImageName))
    fs = new FileStream(AppDomain.CurrentDomain.BaseDirectory + ImageName, FileMode.Open);
    else
    // if photo does not exist show the nophoto.jpg file
    fs = new FileStream(AppDomain.CurrentDomain.BaseDirectory + ImageName, FileMode.Open);
    // initialise the binary reader from file streamobject
    br = new BinaryReader(fs);
    // define the byte array of filelength
    byte[] imgbyte = new byte[fs.Length + 1];
    // read the bytes from the binary reader
    imgbyte = br.ReadBytes(Convert.ToInt32((fs.Length)));
    dt.Rows[0]["Image"] = imgbyte;
    br.Close();
    // close the binary reader
    fs.Close();
    // close the file stream
    catch (Exception ex)
    // error handling
    MessageBox.Show("Missing " + ImageName + "or nophoto.jpg in application folder");
    return dt;
    // Return Datatable After Image Row Insertion
    Mark as answer or vote as helpful if you find it useful | Ammar Zaied [MCP]

  • Upload image in PA30 for a pernr getting error 'Either no file exists in the directory or the directory cannot be found'

    Hi ,
    I have uploaded image in AL11 and trying to link to thorough OA_UPLOAD_AND_LINK program. But when crosschecked it is existing there.
    passed values in selection screen link below= >
    while doing it an error is coming 'Either no file exists in the directory or the directory cannot be found'.
    Directory is identified by program but file does not.
    Any solution?
    P.S. files are uploaded and saved in JPG format

    Try to clear the flag "Processing in Front End", in this way the program will search for the file on application server and not from the front end.
    Or select a file directly from your computer.
    Regards.

  • Importing topics overwrites existing image files

    Whenever I import a topic from one project into another,
    RoboHelp 6 does not check my existing image filenames to make sure
    it doesn't overwrite an image with the same name. This happens even
    if I create a new folder in the destination project and import into
    it. I would expect that it would import the images into that same
    folder, instead of overwriting the existing image files.

    I'm afraid RH doesn't work like Windows Explorer. The only
    way around this is to rename the file being imported or the image
    file in the project into which the other files are being imported.
    Remember to do this inside your RH project though ;-)

  • Error:  BFILE not exists when i insert an image file(.jpg)

    Hi,
    i have created a directory
    called sampl_dir as '/home/oracle/files'
    i have an image file(.gif) and 3 pdf filesin the
    directory.
    i insert 4 rows in to the table using BFILE for all
    the 4 LOB.
    i get output in TOAD, where for all the pdf files, but when i select * from table.
    for all the pdf files output says 'EXISTS' but for the image(.gif) FILE, the
    output says 'NOEXIST'
    I tried putting all the files in different locations
    and tried giving different file owner, and group owner
    but whatever permissions i set or wherever i put the
    files, the output always says 'EXISTS' for pdf files
    but not for gif file.
    so i was thinking there is something got to do with
    the format of the image file, or is there someother
    way to select image from the table. i mean i thought
    "select * from table" may be does not work for images
    but it does work for text, pdf documents. am i right?
    how do i solve this?
    Thanks,
    Philip.

    Hi Kamal,
    this was the plsql code i used to load image file and read the length. and it did not work
    DBMS_LOB.LOADBLOBFROMFILE(v_dest_blob, v_source_locator1, DBMS_LOB.LOBMAXSIZE, v_dest_offset, v_source_offset);
    DBMS_OUTPUT.PUT_LINE('Size of BLOB post-load: '||(v_dest_offset -1));
    but now i modified the above as the following one shown below and it worked, can u tell what was the problem with the above code
    DBMS_LOB.LOADBLOBFROMFILE(v_dest_blob, v_source_locator1, DBMS_LOB.LOBMAXSIZE, v_dest_offset, v_source_offset);
    DBMS_OUTPUT.PUT_LINE('SIZE OF IMAGE FILE: ' ||DBMS_LOB.GETLENGTH(v_dest_blob));
    i did the select query as u told for selecting the length and now it works and i am able to see the output length as 27342.
    Okay Kamal, now is there a way that i can view a pdf file and image file after i select them from the table. i mean when i do a select query on the blob column, i only see result as "(HUGEBLOB)". BUT instead can i see whether what is the blob that is stored like whether it is a pdf or image and what is the name.
    how can i actually see the blob file names etc.
    Thanks,
    Philip.

  • I want to convert two image files into strings and than to compare them. This is easy, but how to mention where the difference exist?

    I have two image file in bmp file format. How to convert them into string and to check if they are differnt or same. If different how to mention or find that where the difference exists. This idea have to be extented with video application as well.

    Hi,
    if you have vision, you could use the functin IMAQ Image to Array to have a 2D array of the pixel values.
    You can then compare pixel by pixel; if your images come from a camera, I would recommend to set a treshold of acceptance.
    This is a time consuming solution anyway.
    Alternative methods:
    1) Make a subtraction of the two images, the resulting image will be the difference of them
    2 ) Use IMAQ LogDiff function (operators palette)
    3) Calculate the histogram of both image and compare the histogram reports
    Good luck,
    Alberto

  • How to update an image file into existing file

    how to update an image file into existing file

    Hi,
    So, i assume you want to change one picture. On Stage, i have edgeAnimate (an image), and
    1) i am using the div tag.
    So: sym.$("edgeAnimate").css("background-image", "url(images/myImage.png)" ); will change my picture.
    Link: CSS properties.
    More CSS:
    sym.$("edgeAnimate").css( { "background-image": "url(images/myImage.png)", "background-size": "100% 100%", "background-repeat": "no-repeat", "cursor": "pointer" } );
    Using a path variable:
    var myPath = "images/myImage.png";
    sym.$("edgeAnimate").css( { "background-image": "url("+myPath+")", "background-size":"100% 100%", "background-repeat":"no-repeat", "cursor": "pointer" } );
    2) i am using the img tag.
    I can add a class using Edge Animate user interface.
    I choose one class name: "newImage".
    So:  sym.$(".newImage").css("background-image", "url(images/myImage.png)" ); will change my picture.
    Note: I assumed you don’t need to preload your picture.

  • Which programs if any can extract the image from existing QTVR pano file?

    Which programs if any can extract the image from existing QTVR panorama files that were created with one image?
    Any ideas?
    Thank you

    Unless you can find an open source ODBC driver for SQL Server that runs on Solaris (and I wouldn't be overly hopeful there) Heterogeneous Services would require that you license something-- a third party ODBC driver, a new Oracle instance, or an Oracle Transparent Gateway.
    As I stated below, you could certainly use SQL Server's ETL tool, DTS. Oracle's ETL tools would require additional licensing since you're just on 9.2. You could also write a small application (Java or otherwise) that connected to both databases and transferred the data. If you're particularly enterprising, you could load the SQL Server Type 4 JDBC driver into Oracle's JVM and write a Java stored procedure that connected to the SQL Server database via JDBC, but that's a pretty convoluted approach.
    Justin

  • Need advice on how to import / store existing image files into LR etc.

    Hi,
    I am just beginning to use LR 2.3 and I want to start correctly....
    I have been pondering how to begin and I was hoping some of you might point me in the right direction.
    1. I have all of my RAW files on my Mac's desktop and they are organized at the top level by each of the 2 cameras they were taken with and then the sub folders of each organized chronologically with each subfolder titled by the location or subject of the images matter within each folder.
    I want to import these into LightRoom 2.3 in a manner which will preserve this taxonomy. I also want to convert these RAW images into DNG files on import. How do I set up LR2 to do this?
    2. I want the Lightroom files and the image files to live on my external Caldigit eSATA VR drive. This drive is actually 2 disks set to mirror as hardware RAID 1 so it is essence its own backup if one disk dies. How do I point LR to create and store the DNG files on this external drive and then set LR2 to back up so that the LR datafiles also live there? Would you say this is a good way to set this up or should the LR datafiles ( previews etc. live with LR on the OS drive??
    Is RAID 1 as safe as backing up to 2 different HD's?
    Is it best to convert to DNG ( I like the fact that any LR image data is stored with the DNG and is not a sidecar file which could get seperated) or convert to DNG with orginal RAW file incorporated? How massive do these get?
    Is it best to use LR2's backup utility and exclude the LR data from the Time Machine backup?
    Sory for the long question...

    >1. I have all of my RAW files on my Mac's desktop and they are organized at the top level by each of the 2 cameras they were taken with and then the sub folders of each organized chronologically with each subfolder titled by the location or subject of the images matter within each folder.
    >I want to import these into Lightroom 2.3 in a manner which will preserve this taxonomy.
    >I also want to convert these RAW images into DNG files on import. How do I set up LR2 to do this?
    On the Import Photos Screen, pick "Copy photos as Digital Negative(DNG) and add to catalog" from File Handling drop-down at top of screen.
    If your photos are organised as:
    Photos - Camera 1 ...
    - Camera 2 ...
    then Lightroom will reflect that folder view in its Folders panel. Also, when converting to DNG you get to choose destination folder (answers part of your question 2) and multiple organisation choices including "Organize by Original Folder"
    (Take a look at Chapter 4 of the help file for more information: http://help.adobe.com/en_US/Lightroom/2.0/lightroom_2_help.pdf)
    2. I want the Lightoom files and the image files....
    Create your catalog on that drive. Move your images to that drive before importing them, and when converting to DNG on import, choose a folder on that drive as destination on import screen.
    >Is RAID 1 as safe as backing up to 2 different HD's?
    No. RAID 1 is a simple mirror of 1 drive on another; so if you delete a file on drive, it is also deleted from both drives. Likewise, if a file is corrupted on one drive it will also be corrupted on the mirror. RAID 1 is good as a safeguard against single-drive failure; your data will be available from the remaining drive, but it is not a safeguard against user error or file corruption.

  • Opening an image file in an existing TextEdit window

    I'm blocked on this, which seems it should be straightforward (but maybe it isn't).
    If I have an open TextEdit window on the desktop and drag an image file to it, the image appears in the window.
    How do I replicate that result with AS?

    Hi red_menace
    Your proposed approach seems reasonable, although I haven't tried it. Rather, I'm looking at other ways of achieving the present goal. That is to open a small window on the desktop with an embedded image and embedded text -- and then, at certain dates (not a problem), move the window to a different position, perhaps with a different image and different text.
    A TextEdit window certainly wasn't ideal for this, as it has baggage I can do without -- a ruler (which can be eliminated with a system events command), a title, and the three manipulation buttons.
    A window that would better meet my needs would be a "Stickies" window, but Stickies isn't scriptable.
    I can move it around fine with Finder commands, and I can close it. If I create all the windows I will need ahead of time (there are a limited number), I don't know whether it's possible to bring them up selectively -- I don't even know where/how the files are stored; I've looked at the package contents and don't find them there. I'm talking about the files for Stickies window that appear when Stickies is launched.
    The only other app I've found with a fairly basic window layout is Core Image Fun House.app, which also isn't scriptable -- but maybe I can get a bead on its stored files.
    Or maybe there are other choices . . . ?
    I'd welcome suggestions but in the meantime will just keep playing around with it. This is not the most urgent matter in the world!
    osimp

  • Exist an easy way to convert base64 code in XML files into the original image file on forms

    I've made a form in lifecycle that will be distributed by email as a pdf, and submitted back to me as an XML file and then that data imported into the pdf form template to view the data. Issue is I have an "attach image" field on the form and in XML it gets written to a base64 encoded format. Is there convenient way to extract this code from the XML file so that I would have a workable jpeg image file that I can save and open in other apps? Thank you in advance!  -Robert Tampa

    I tried to make John Brinkman's sample working in reverse.
    This script will grab an image field's value and produce an attachment (png-file), which then can be saved to the hard drive.
    //Get Base64 data of the image field
    var b64Data = ImageField1.value.image.value;
    //Convert to a read stream
    var ReadStream = util.streamFromString(b64Data);
    //Decode from Base64
    var DecodedStream = Net.streamDecode(ReadStream, "base64");
    //Attach an empty image file
    event.target.createDataObject("MyExportImage.png", "", "image/png");
    //Update attached image file with stream data
    event.target.setDataObjectContents("MyExportImage.png", DecodedStream);
    //Show attachment pane
    event.target.viewState = {overViewMode:7};
    This works so far, but the produced images are always cutted off.
    No idea what's the reason for this behavior.

  • Help!Importing images to existing folder in Aperture

    Hi everyone,
    I am currently try to use Aperture to organise my image files. I have a very large image library appoximatly 100GB, they are already been organised in different folder, and been backed up on the server. But because the library is taking up a huge amount of space on the machine, I moved my library onto a external HDD. However, after I have deleted all the images(not the folders), I will need to add more images into the folders on the machine, then add them into Aperture library. The problem I am having, is whenever I try to add the new images, Aperture will automaticlly create a folder for me with the same folder name again, rather than adding them into the exiting project. Is there a way to import new images to exiting project which I imported before without having Aperture creating new folders for me?
    The difficult part is because it is not going to be 3 or 4 images in one folder, but over 100000 images in different folders, how I can transfer the image without have to make any changes to the project in Aperture?
    Many thanks in advance!
    Ken

    Hi Celineken-
    If I understand you correctly, you have new images in a folder on a disk somewhere, and projects in your Aperture library with the same name as one or more folders on the disk. When you import the new images, Aperture is creating a new project with the name of the folder on the disk and importing the images there, instead of the already-existing project with the same in your library, is that right?
    If so, happily there is a simple solution for you: Open the Import Pane and navigate to the folder with the new images. Select the images you want to import, then click the Destination popup in the upper right of the screen, under the heading "Aperture Library". Change the Destination from New Project to the project of your choice. You can also save a step and just click the project from the Projects list on the left side of the Import Pane. Now, when you click the Import button, the photos will be imported into the project you specified.

Maybe you are looking for

  • Safari - no address bar

    This morning there was no address bar to type a www. in. Tried 'View' but it just had 'hide address...' Tried 'cutomise...' but the only clickable are was 'Done' - nothing else. Possibly, I've pressed a sequence of tabs on the keyboard but the bar wa

  • Unable to connect to the report server

    I have a problem with run_report_object to call a report within a form. I am using 9ias Rel 2 and report server on the same machine. The test.rdf report can be executed using the URL in the browser. I get the "Unable to connect to the report server"

  • Help with ymouse restriction

    Hi all this is beyond my skill so I am hoping you can help. I have a scrolling movie clip that scolls left or right depending on where your mouse moves on the ENTIRE stage. I want to confine it to only work when the mouse is over the scorlling clip.

  • Password policy not applying properly

    I have set password policy for my domain that Maximum age: 60days Minimum age is: 45days but I get messages every week that passwords would expire in 4 days I checked using rsop.msc and policy seems to be correctly applied. what could be the problem?

  • C calling java package fails....

    Hello; I created a C program to call a native java program. I have the program in a directory named world. I works great,but when I change the program and create a package and try to execute the FindClass to the package version I can not find it. Sin