Bill Gates is my home boy
Gender:
Posts: 710
4449 credits Members referred : 2
« on: Jul 25, 2009, 09:32:11 pm »
I am trying to make a header for a Wordpress blog that is made up of 5 random images. I tried getting one of the WP widgets to work and while it did not throw any errors, it didn't display any of the images either.
After spending way too long messing with it, I thought maybe I could do my own thing and come up with exactly what I wanted instead of making something else work.
I think I may have stumbled onto a really slick way to generate the random numbers except my efforts lead to no image being displayed either. lol
So, here's what I've got...
A sub-directory in my theme's directory called random-image. In it are files named 1.jpg, 2.jpg, 3.jpg etc.
I'm getting a random number ($random_1).
I had hoped I could add on the directory and .jpg extension when making the image display. That didn't seem to work so I created another variable $file_1 and took the random number and added ".jpg" to it. Again, no luck on getting the image to display.
Both $random_1 and $file_1 contain the correct information and the values for both display fine. But, I can't seem to use them to display the images.
My thinking is to do something like this within the <?php ?>
General random #1. Create file name #1. Display image #1.
Generate random #2. Create file name #2. Display image #2.
etc.
Ideally, I would like to use the images side by side as my page header so there may need to be divs or spans to format each image so I'm thinking that the images have to be displayed from within the php code.
I have been all over the web and nothing seems to work. I don't know if there's something special I need to do because it's WordPress, the image display code is wrong or I can't build a file name the way I am.
Perhaps my post will help someone else as I've spent way to much time on something that should have been simple.
Ultimately the issue was taking the image display call out of the php and using php within the img tag and using a WP variable for the directory where the template files are located...
My name is Bong, James Bong
Posts: 10
64 credits Members referred : 0
« Reply #2 on: Dec 12, 2009, 03:50:48 pm »
I also get stuck on that header images issue...I made some search and found dynamic header plugin at wordpress...it does have an issue on the image resize..cheers
Cyberpunk Wannabe
Posts: 41
246 credits Members referred : 0
« Reply #3 on: Aug 05, 2010, 06:42:45 am »
is $random_1 int variable?
Sandwich Artist
Gender:
Posts: 26
168 credits Members referred : 0
« Reply #4 on: Sep 21, 2010, 07:06:06 pm »
I am a similar problem to them. I needed to automate the process so that users can upload images to the server and that they appear random in the header, regardless of the image name ... I used a php script to read the content directory, and for its display random image java script ...
Nikolas' Servant's Servant
Posts: 29
186 credits Members referred : 0
« Reply #5 on: Jul 22, 2011, 10:27:28 am »
Its the best funchion for show your and other Images with the help of PHP.
Cyberpunk Wannabe
Posts: 41
300 credits Members referred : 0
« Reply #6 on: Oct 06, 2011, 09:28:58 am »
Looking for code for displaying image in PHP page. I have tried but not working.
« Last Edit: Oct 06, 2011, 10:34:55 am by Nikolas »
My name is Bong, James Bong
Gender:
Posts: 11
66 credits Members referred : 0
« Reply #7 on: Nov 24, 2011, 01:29:51 pm »
Uses an external PHP file to auto retrieve all images within a directory to show on the fly. Customize the album's dimensions as desired, such as 3 by 2 images, 4 by 5 images etc. Ability to sort the display order of the images by file or date, in ascending or descending order.
Hunky Junky Monky Man!
Posts: 67
438 credits Members referred : 0
« Reply #8 on: Nov 24, 2011, 03:14:56 pm »
How to display Image in php page- PHP Development. Visit Dev Shed to discuss How to display Image in php page.
Hunky Junky Monky Man!
Posts: 67
438 credits Members referred : 0
« Reply #9 on: Dec 09, 2011, 11:40:22 am »
hi all i am working on a website that will display projects and many images for each project. i want to make an interface
I crack Photoshop!
Posts: 3
18 credits Members referred : 0
« Reply #10 on: Apr 02, 2012, 07:17:47 pm »
i will tried
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=8977