Wrox Programmer Forums
|
BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5
This is the forum to discuss the Wrox book Beginning PHP4 by Wankyu Choi, Allan Kent, Chris Lea, Ganesh Prasad, Chris Ullman; ISBN: 9780764543647
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 22nd, 2003, 03:22 PM
Registered User
 
Join Date: Nov 2003
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Scrolling Image PHP?

I've seen it done a million times in Java, but is there a way to scroll a group of images using only php?

What I want to do is grab the paths to about 10 images from a MySQL DB and display them, but I don't want to take up the whole page with images. So making it possible to scroll through them in the space of 1 image makes sense.

I think it would keep my pages a lot cleaner if I don't have to mix php and Java. Any ideas?

The best ideas are not the simple ones, they're the complex ones made easy.
 
Old December 22nd, 2003, 04:43 PM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Keep in mind that PHP cannot control anything on the client-side environment. PHP can to an extent work with Java. If that is what you want then have a look at the manual pages on PHP/Java Integration.

http://www.php.net/java

Personally I'd use an inline frame and some JavaScript.

Here's a working example of that method:

Code:
<html>
    <head>
    </head>
    <body>
        <script language='javascript' type='text/javascript'>

            var scrolling;

            function startScroll(theframe)
            {
                scrolling=setInterval('window.' + theframe + '.scrollBy(0,12);', 100);
            }

            function stopScroll()
            {
                clearInterval(scrolling);
            }

            function back(theframe)
            {
                scrolling=setInterval('window.' + theframe + '.scrollBy(0,-12);', 100);
            }

        </script>

        <a href='javscript:void(0);' onmouseover='back("this_iframe")' onmouseout='stopScroll()'>Scroll Up</a><br />
        <iframe src='' name='this_iframe' id='this_iframe' style='width: 50px; height: 50px;' frameborder='0' scrolling='no' /></iframe><br />
        <a href='javascript:void(0);' onmouseover='startScroll("this_iframe")' onmouseout='stopScroll()'>Scroll Down</a><br />

        <script language='JavaScript' type='text/javascript'>
            frames['this_iframe'].document.open();
            frames['this_iframe'].document.write("<html><head><body>");
            frames['this_iframe'].document.write("<img src='image1.jpg' style='width: 25px; height: 25px;' /><br />");
            frames['this_iframe'].document.write("<img src='image2.jpg' style='width: 25px; height: 25px;' /><br />");
            frames['this_iframe'].document.write("</body></html>");
            frames['this_iframe'].document.close();
        </script>

    </body>
</html>
The code which writes to the iframe, for this example must appear *after* the iframe. Of course you could modify that to use an external source file also. Also the custom scrolling aparatus can be made auto or self-scrolling, use images instead of links.

hth,
: )
Rich


:::::::::::::::::::::::::::::::::
Smiling Souls
http://www.smilingsouls.net
:::::::::::::::::::::::::::::::::





Similar Threads
Thread Thread Starter Forum Replies Last Post
Image with php from msaccess sua234 Beginning PHP 0 March 9th, 2008 01:33 AM
php image resize danu_322 PHP FAQs 0 November 2nd, 2007 09:29 AM
Image Fading Using PHP [email protected] PHP How-To 0 April 27th, 2007 03:58 AM
Image error in php Randhy Beginning PHP 2 January 13th, 2005 05:56 AM
php gd2/image anshul Pro PHP 3 November 23rd, 2004 12:27 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.