Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Images

Dynamic img from database to Gallery

images php coding issues or problems here.

Moderators: macek, egami, gesf

Dynamic img from database to Gallery

Postby blocktshirts » Fri May 20, 2011 11:07 am

Hi,
I'm new to the forum,
My site uploads images from my data base, http://www.blockdesigns.co.uk/Product.php?Sku=20075

I want to have two thumb nails under the main image and for it to swap like this: http://www.glow.co.uk/glow-t-shirt-glowstick.html

I know how to do this when I put the image address in but as it's a dynamic site I need to put a variable $image into the coding.

Any ideas please? whats the best way to do this at the moment I have done a Jquery that goes to an external php program but I then lose my GET variable.

Hope this is making sense as I seem to be waffling.
blocktshirts
New php-forum User
New php-forum User
 
Posts: 3
Joined: Fri May 20, 2011 10:57 am

Re: Dynamic img from database to Gallery

Postby scieck » Fri May 20, 2011 8:53 pm

Not sure how much control you have over the code that retrieves the $image from your database.

but if you can change the code that retrieves the $image variable and instead of returning a single string your return an array with the two images you could have something like this:

Code: Select all
<img src="<?php echo $image[0] ?>" alt="" />
<img class="hidden" src="<?php echo $image[1] ?>" alt="" />


Then the two img tags above can be manipulated using jQuery.
scieck
New php-forum User
New php-forum User
 
Posts: 4
Joined: Fri May 20, 2011 7:48 pm

Re: Dynamic img from database to Gallery

Postby webinfopedia » Sat May 21, 2011 10:50 pm

In this case you have to make a thumbnail image which links to a full sized image. So that it will reduce you page loading time and loading of web page will be fast. For this we have to use PHP Dynamic thumbnail creation
Code: Select all
<img  src="http://www.webinfopedia.com/classes/thumbnail.php?file=http://www.webinfopedia.com/images/image-thumbnail-in-php.jpg&width=100&height=80&amp;maxw=102&amp;maxh=82">

I have explained this in one article here http://www.webinfopedia.com/create-thumbnail-image-dynamically-using-PHP.html
Thank You
User avatar
webinfopedia
New php-forum User
New php-forum User
 
Posts: 84
Joined: Sat May 21, 2011 10:26 pm

Re: Dynamic img from database to Gallery

Postby blocktshirts » Sun May 22, 2011 1:20 am

cheers for that people,
I will have a play with this code today and let you know how I get on.
blocktshirts
New php-forum User
New php-forum User
 
Posts: 3
Joined: Fri May 20, 2011 10:57 am

Re: Dynamic img from database to Gallery

Postby blocktshirts » Sun May 22, 2011 10:37 am

HI guys,
I have managed to sort it now.
I've probably not explained it very well but all I needed to do was carry the $image names across with the Jquery function.

cheers for the advice
blocktshirts
New php-forum User
New php-forum User
 
Posts: 3
Joined: Fri May 20, 2011 10:57 am


Return to PHP coding => Images

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.