GetDotted Domains

Viewing Thread:
"Displaying jpg pic with PHP"

The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.

Sun 08/02/09 at 22:55
Regular
"wheres the Any Key?"
Posts: 161
hiya all

i have a webpage that displays a players profile when his name is selected from a drop down menu, the profile info is retrieved from a Database table and displayed, i`d like to display the players picture as well, but not sure on how to do this.

At present i have the pics stored in a folder on the webserver called profilepics.

Could anyone help me with the code to select the correct picture from that folder when retieving the players profile from the database?

Or should i be storing the pic in the database? (if so even more help is needed.)

Any ideas or help would gr8.

Many thx in advance.
Fri 13/02/09 at 17:47
Regular
"wheres the Any Key?"
Posts: 161
JimTheDog wrote:
> Hi Tappet,
>
> Next time I'll actually read the question properly. I thought
> you were trying to create a combo box which displayed a members
> name and a photo in the list - it's this which I don't think can
> be done.
>
> Pleased you got sorted anyway.
>
> JTD

Lo JTD

Maybe your mis-understanding was due to my poor explaination, but no worries cos its all sorted now, plus ive also learnt that you can not create a combo box which displayed a members name and photo in a list.

So thx for your incorrect but interesting advice.

Have a good wkend.
Fri 13/02/09 at 17:34
Regular
"wheres the Any Key?"
Posts: 161
Lo Eccles

Thx for spreading some light and also the advice.
Thu 12/02/09 at 22:19
Staff Moderator
"Aargh! Broken..."
Posts: 1,408
Sound like you've fallen victim to browser caching. IE is a pain for that. The rule is that if you are developing a site that uses images, CSS and/or Javascript and you update any of those elements and don't see a change then clear the browser cache. Glad it's sorted now though.
Thu 12/02/09 at 21:52
Regular
"Ctrl, Alt, Woof"
Posts: 212
Hi Tappet,

Next time I'll actually read the question properly. I thought you were trying to create a combo box which displayed a members name and a photo in the list - it's this which I don't think can be done.

Pleased you got sorted anyway.

JTD
Thu 12/02/09 at 19:41
Regular
"wheres the Any Key?"
Posts: 161
Lo Eccles,

All the pictures display correctly when using HTML and i have the same address stored in the database, but when i change the HTML code to PHP it just displays the red cross with the alt txt,

HTML
<img src="/Images/playerpics/playersname.jpg" width="122" height="172" alt="/Images/playerpics/playersname.jpg(26kb)" />

which displays correctly

PHP
<img src="<? echo $pic; ?>.jpg" width="122" height="172" alt="<? echo $pic; ?>.jpg (26kb)">

which displays a grey box with
X /Images/playerpics/lewispro.jpg

NO WAY! I've just opened the web page that displays these profiles to double check the alt text in the above paragraph and there is no grey box & no ALT text, instead its displaying the correct photo. This simple piece of code has mashed my head to a frustrated pulp over the last 2 nights, then 2nite without even opening the file in my txt editor it runs correctly. I dont know why the same piece of code did not work y'day but does work today, but it has reminded me of a saying my granddad use to say; "Theres no such thing as a computer error, they only do what they are told to do." so i put my hands up and accept responsibilty for creating a problem where there was no problem, even though i can't see any differnce in the PHP code i originally posted to the code posted above.

Thx 2 all that have spared some time to offer help and next time i'll try to post a proper problem.

Keep safe and happy coding
Thu 12/02/09 at 13:16
Staff Moderator
"Aargh! Broken..."
Posts: 1,408
If you images aren't display and you can verify the images actually exist using FTP then either the image path is wrong or the permissions for the folder the image is are incorrect. If you want you can send me details of the site using the link under my name and I could have a quick look.
Thu 12/02/09 at 00:47
Regular
"wheres the Any Key?"
Posts: 161
lo JTD,
Thx 4 ya posting and once again your fine advice. what at 1st seemed to be a simple task is proving to be quite a challenge. I too have found relevant examples & postings etc elsewhere and even tho these people post "thx for the help and claim the code works" it clearly doesn't.

As helpful as all your advice has been and im sure still will be in the future i think its about time i invested in some literature as im starting to think my trial and error, learn as i dabble method is to shallow for the depth ive fell into. And that reminds me, thx for the posting relating to my GAD prize, as a newbie to web design i very rarely view the winners list and if it wasn't for reading your posting i would of never know (or not until it was to late) that i had won a GAD.

Right im off to invest my winnings in a book full of code which im sure will be simply get more confussing and i'll get back to ya on how i solved this prob.

Many thx once again

and keep safe m8.
Wed 11/02/09 at 21:19
Regular
"Ctrl, Alt, Woof"
Posts: 212
Hi Tappet,

I hope someone can prove me wrong here, but I looked into doing exactly the same thing some time ago and came to the conclusion (after many hours of trawling sites that promise lots but deliver little) that you can't do it.

There are a few ways of emulating drop down list by the use of tables but, like you say, it doesn't give you a postable value.

I'll keep looking for a solution but I thought you'd appreciate not being alone in finding such a simple concept so difficult to execute.

JTD
Wed 11/02/09 at 17:55
Regular
"wheres the Any Key?"
Posts: 161
evening all !

ive still got the same prob which is, the picture does not display, im retrieving the address for the photo from the database and storing it in $pic then using the following code to display it....

<img src="<? echo $pic; ?>.jpg" width="122" height="172" alt="<? echo $pic; ?>.jpg (26kb)">

but it just displays the 'alt' which is show as the correct address.
ie. "http://www.domain.com/images/playersname.jpg( 26kb)"

anyone have any ideas where im going wrong?

Many thx in advance!
Mon 09/02/09 at 21:29
Regular
"wheres the Any Key?"
Posts: 161
hiya Eccles,
Thanks for the reply and 4 pointing me in the right direction.

Freeola & GetDotted are rated 5 Stars

Check out some of our customer reviews below:

Thank you very much for your help!
Top service for free - excellent - thank you very much for your help.
Best Provider
The best provider I know of, never a problem, recommend highly
Paul

View More Reviews

Need some help? Give us a call on 01376 55 60 60

Go to Support Centre
Feedback Close Feedback

It appears you are using an old browser, as such, some parts of the Freeola and Getdotted site will not work as intended. Using the latest version of your browser, or another browser such as Google Chrome, Mozilla Firefox, or Opera will provide a better, safer browsing experience for you.