Playing with PHP, maybe some help.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Validus
    Confirmed User
    • Jul 2001
    • 4012

    #1

    Playing with PHP, maybe some help.

    I am just playing around with some PHP script I found. Already modified it a little but this part I am just not happy with.

    PHP Code:
    $output .= "<a href=\"hahahahahahahahahaha:windowHandle = window.open('".$target."','".md5($target.time())."','width=".($size[0]+20).",height=".($size[1]+25).",location=no,resizable=no'); windowHandle.focus();\"><img src=\"thumb$jpegs[$picnum]\" border=\"0\" alt=\"Click to view $jpegs[$picnum]\"></a>"; 
    
    I would like it to open in a new window, as it does now but load the full sized picture within a HTML page, so I can change background color and such things.

    Any ideas? I am not a programmer so for me it is just click and type and play and fail? sometimes it works.. but sometimes it doesn?t
  • BJ
    Confirmed User
    • Mar 2002
    • 5590

    #2
    lets all eat ham?

    Comment

    • michaelw
      Confirmed User
      • May 2002
      • 1342

      #3
      whats $target
      <b><a href="http://www.hotlinkprotector.com"><font color="yellow">Hotlink Protector</font></a> - Protect all your file types from hotlinking the professional way. <br>
      See a demo <a href="http://www.hotlinkprotector.com/demo.html"><font color="yellow">here</font></a>, and testimonials <a href="http://www.hotlinkprotector.com/testimonials.html"><font color="yellow">here</font></a><br>ICQ: 146423631

      Comment

      • Alky
        Confirmed User
        • Apr 2002
        • 5651

        #4
        im confused, what is it not doing?

        Comment

        • Validus
          Confirmed User
          • Jul 2001
          • 4012

          #5
          Originally posted by michaelw
          whats $target
          It is the path to the picture I believe... well the file name of the picture :-)

          Comment

          • Validus
            Confirmed User
            • Jul 2001
            • 4012

            #6
            Originally posted by Alky
            im confused, what is it not doing?
            Well it just opens in a new window, but I got almost no control over that window. No background color and such and I can?t add any other small things.

            Comment

            • michaelw
              Confirmed User
              • May 2002
              • 1342

              #7
              $target is the page youre opening..

              my suggestion would be to change $target to point to a php page, right now its opening up just the picture..

              make it open something like
              $target = "page.php?image=thumb$jpegs[$picnum]"

              then make a new php script page.php, and make it show whatever image was passed - ie
              PHP Code:
              echo "<img src=\"$image\" border=\"0\">"; 
              
              <b><a href="http://www.hotlinkprotector.com"><font color="yellow">Hotlink Protector</font></a> - Protect all your file types from hotlinking the professional way. <br>
              See a demo <a href="http://www.hotlinkprotector.com/demo.html"><font color="yellow">here</font></a>, and testimonials <a href="http://www.hotlinkprotector.com/testimonials.html"><font color="yellow">here</font></a><br>ICQ: 146423631

              Comment

              • Alky
                Confirmed User
                • Apr 2002
                • 5651

                #8
                Originally posted by Validus


                Well it just opens in a new window, but I got almost no control over that window. No background color and such and I can?t add any other small things.
                all of the colors of that window are controlled in the html of the page in your $target variable.

                Comment

                • Validus
                  Confirmed User
                  • Jul 2001
                  • 4012

                  #9
                  Originally posted by Alky
                  all of the colors of that window are controlled in the html of the page in your $target variable.
                  Hmm.. look at the code again, then you know what I mean. If there is a way to control the window.. let me know what tags to use.. thanks.

                  Comment

                  • Validus
                    Confirmed User
                    • Jul 2001
                    • 4012

                    #10
                    Originally posted by michaelw
                    $target is the page youre opening..

                    my suggestion would be to change $target to point to a php page, right now its opening up just the picture..

                    make it open something like
                    $target = "page.php?image=thumb$jpegs[$picnum]"

                    then make a new php script page.php, and make it show whatever image was passed - ie
                    PHP Code:
                    echo "<img src=\"$image\" border=\"0\">"; 
                    
                    ahhh.. nice.. ok.. let me try... thank you!

                    Comment

                    • michaelw
                      Confirmed User
                      • May 2002
                      • 1342

                      #11
                      theres no real way to control it with tags.. youre going to have to do some hefty dhtml work to get it to work the way you want it to, and that wont even work properly with other browsers

                      right now, youre opening up the image itself.. you cant change the background if u open an image in a new window.

                      you have to point it to a php page, and pass a variable to tell the php script what image to load. in that php script, u can change all the backgound and other goodness
                      <b><a href="http://www.hotlinkprotector.com"><font color="yellow">Hotlink Protector</font></a> - Protect all your file types from hotlinking the professional way. <br>
                      See a demo <a href="http://www.hotlinkprotector.com/demo.html"><font color="yellow">here</font></a>, and testimonials <a href="http://www.hotlinkprotector.com/testimonials.html"><font color="yellow">here</font></a><br>ICQ: 146423631

                      Comment

                      • Validus
                        Confirmed User
                        • Jul 2001
                        • 4012

                        #12
                        Hm, ok. I am still confused about it.

                        on how to implement that code...

                        Here is more of my script...


                        PHP Code:
                        
                        $size = getimagesize($jpegs[$picnum]);
                        $target = str_replace('%picname%', $jpegs[$picnum], $linkurl);
                        $output .= "<a href=\"hahahahahahahahahaha:windowHandle = window.open('".$target."','".md5($target.time())."','width=".($size[0]+20).",height=".($size[1]+25).",location=no,resizable=no'); windowHandle.focus();\"><img src=\"thumb$jpegs[$picnum]\" border=\"0\" alt=\"Click to view $jpegs[$picnum]\"></a>"; 
                        

                        Comment

                        • Alky
                          Confirmed User
                          • Apr 2002
                          • 5651

                          #13
                          Originally posted by Validus
                          Hm, ok. I am still confused about it.
                          this way:
                          PHP Code:
                          
                          $size = getimagesize($jpegs[$picnum]);
                          $target = str_replace('%picname%', $jpegs[$picnum], $linkurl);
                          $output .= "<a href=\"hahahahahahahahahaha:windowHandle = window.open('".$target."','".md5($target.time())."','width=".($size[0]+20).",height=".($size[1]+25).",location=no,resizable=no'); windowHandle.focus();\"><img src=\"thumb$jpegs[$picnum]\" border=\"0\" alt=\"Click to view $jpegs[$picnum]\"></a>";
                          echo $output; 
                          
                          Last edited by Alky; 05-11-2003, 11:20 PM.

                          Comment

                          • Validus
                            Confirmed User
                            • Jul 2001
                            • 4012

                            #14
                            Originally posted by Alky

                            this way:
                            PHP Code:
                            
                            $size = getimagesize($jpegs[$picnum]);
                            $target = str_replace('%picname%', $jpegs[$picnum], $linkurl);
                            $output .= "<a href=\"hahahahahahahahahaha:windowHandle = window.open('".$target."','".md5($target.time())."','width=".($size[0]+20).",height=".($size[1]+25).",location=no,resizable=no'); windowHandle.focus();\"><img src=\"thumb$jpegs[$picnum]\" border=\"0\" alt=\"Click to view $jpegs[$picnum]\"></a>";
                            echo $output; 
                            
                            Now I am really list, don't know if its just because I can't see how that code is different.. or cause I missed something.

                            Comment

                            • Validus
                              Confirmed User
                              • Jul 2001
                              • 4012

                              #15
                              all working... super thanks again... :-)

                              Comment

                              • Alky
                                Confirmed User
                                • Apr 2002
                                • 5651

                                #16
                                uh huh..

                                Comment

                                • Dragon Curve
                                  Confirmed User
                                  • Oct 2002
                                  • 252

                                  #17
                                  Some hahahahahahahahahaha here would enable you to modify the background of the opened window. *sigh*

                                  Comment

                                  • dimonka
                                    Confirmed User
                                    • Oct 2002
                                    • 477

                                    #18
                                    Can't catch the point of the problem...try reading manual for GetImageSize function...

                                    Find out what REBILLS are!

                                    Comment

                                    Working...