29, May 2012

php Image Display - webmaster forum

 
Webdigity webmaster forums
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: php Image Display
« previous next »
Pages: [1] Print
Instabuck - The easy way to sell digital products online

Author Topic: php Image Display  (Read 2185 times)
Bill Gates is my home boy
*****
Gender: Female
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.

Any help would be greatly appreciated.

« Last Edit: Jul 25, 2009, 09:46:57 pm by YMC »

www.yourmessageconsultant.com, providing online content and printed marketing materials.
www.helpforwebbeginners.com, Tutorials and how to's for new  webmasters.
www.CraftyTips.com, a unique Arts & Crafts Directory
www.nocans.com - Pet Food Recipe Site
www.petsiteguides.com - A New Pet Directory

Last blog : Spring Cleaning at Crafty Tips
Bill Gates is my home boy
*****
Gender: Female
Posts: 710
4449 credits
Members referred : 2



« Reply #1 on: Jul 25, 2009, 10:47:49 pm »

After walking away for a while and coming back to this it seemed more and more likely that this had to be a Wordpress issue - it is!

Changed my search strategy and quickly found the solution on the wordpress forums - http://wordpress.org/support/topic/278852.

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...

<img src="<?php echo bloginfo('template_url'); ?>
/random-image/<?php echo $file_1;?>" alt="something goes here" />

www.yourmessageconsultant.com, providing online content and printed marketing materials.
www.helpforwebbeginners.com, Tutorials and how to's for new  webmasters.
www.CraftyTips.com, a unique Arts & Crafts Directory
www.nocans.com - Pet Food Recipe Site
www.petsiteguides.com - A New Pet Directory

Last blog : Spring Cleaning at Crafty Tips
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: Male
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: Male
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
Tags : php variables image display Bookmark this thread : Digg Del.icio.us Dzone more....

Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: php Image Display
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 29, 2012, 01:16:42 am





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!






Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2012 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.