CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9
  1. #1
    Join Date
    Oct 2006
    Posts
    11

    Question Redirect question

    Hello,

    I have quite weird question.
    Is it possible to redirect from a binary page to some other page.
    Source page has Content-type: image/gif.

    Image is readed using binary fopen() and fread() and then outputed on the screen using echo... Problem is that after showing the image some next steps should be done, but script "stops" on this point...

    Is there any way to solve this? Sorry, if it's very lame question...

    WML/PHP4 combination is used. So, meta tags, Javascript can't be used...
    PHP's header("Location: ...") function doesn't work also...
    Webserver is IIS.

    Thanks in advance!

  2. #2
    Join Date
    May 2002
    Posts
    10,943

    Re: Redirect question

    So you are trying to redirect a page that is only showing an image? Is it just the path to the image such as ... http://www.domain.com/path/image.gif?

    Can you possible provide some code with what you are using?
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  3. #3
    Join Date
    Oct 2006
    Posts
    11

    Re: Redirect question

    Yes, I'm trying to redirect from a page, which shows only image.

    Here is the code, I'm using:

    ...
    ob_end_clean();
    if (connection_status() != 0) return FALSE;

    header("Content-Type: image/gif");
    header("Content-Length: " . (string)(filesize($name)));
    header("Content-Disposition: inline; filename=" . $name);
    header("Content-Transfer-Encoding: binary\r\n");

    $bBreak = false;
    $content = "";
    if ($file = fopen($name, 'rb')) {
    while(!feof($file) and (connection_status() == 0)) {
    $content = fread($file, 1024 * 8);
    echo $content;
    flush();
    if($content === FALSE) {
    $bBreak = true;
    break;
    }
    }
    fclose($file);
    }
    if((connection_status() == 0) and !connection_aborted() and !$bBreak)
    return TRUE;
    else
    return FALSE;
    ...


    Some of the code was skipped.
    If you have some hint, I'll be very thankful.

  4. #4
    Join Date
    May 2002
    Posts
    10,943

    Re: Redirect question

    Quote Originally Posted by Korax
    WML/PHP4 combination is used. So, meta tags, Javascript can't be used...
    PHP's header("Location: ...") function doesn't work also...
    Well, that pretty much puts you down to nothing. Since PHP is used, is there a reason why you are not echoing a JavaScript redirect?
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  5. #5
    Join Date
    Oct 2006
    Posts
    11

    Re: Redirect question

    Quote Originally Posted by peejavery
    Well, that pretty much puts you down to nothing. Since PHP is used, is there a reason why you are not echoing a JavaScript redirect?
    Because WML doesn't support Javascript.

  6. #6
    Join Date
    May 2002
    Posts
    10,943

    Re: Redirect question

    Quote Originally Posted by Korax
    Because WML doesn't support Javascript.
    But you can redirect using HTML as well. Can't you echo HTML?

    HTML Code:
    <meta http-equiv="Refresh" content="5;url=http://www.google.com">
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  7. #7
    Join Date
    Oct 2006
    Posts
    11

    Re: Redirect question

    Well, I repeat one more time. The page is done in WML, not in HTML and meta tags can't be used... I wrote it in the first message of this thread.


    Quote Originally Posted by peejavery
    But you can redirect using HTML as well. Can't you echo HTML?

    HTML Code:
    <meta http-equiv="Refresh" content="5;url=http://www.google.com">

  8. #8
    Join Date
    May 2002
    Posts
    10,943

    Re: Redirect question

    Quote Originally Posted by Korax
    Well, I repeat one more time. The page is done in WML, not in HTML and meta tags can't be used... I wrote it in the first message of this thread.
    If META tags cannot be used, why are they part of WML?

    WML META tag
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  9. #9
    Join Date
    Oct 2006
    Location
    slavia
    Posts
    42

    Re: Redirect question

    hi KORAX, please do allow me to answer it
    maybe this one do not answer directly to ur question, but this one is just another suggestion how to do the redirection.
    what about making such thing (i dont remember much those WML tags, but i have learned it before at a glnce )
    Code:
    
    <IMG src="file_that_shows_image.php?image=imageexample.gif">
    <br>
    <a href="link_to_another_page.php">GO TO HERE</a>
    above code just another way how u can show an image produced from PHP into a page, and then add a link below the image to redirect to another page.

    is this what u mean ? please confirm it isnot ...

    thnx


    rgrds,
    szpilman

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured