|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Making a different picture appear every new post
Sorry i forgot to read the forum instructinos. I based my clan member page on Matt Wade's news posting article; however, i can not figure out how to upload a different picture for each member that i post.
This is as far as ive gone with it and im still working on building the rest of the info. What im looking for is an option to browse for a picture when i post or something like that. main posting file PHP Code:
thanks sorry for not reading rules the first time . ![]() Last edited by Bruski : July 11th, 2003 at 09:42 AM. |
|
#2
|
|||
|
|||
|
Bruski,
Are you receiving any error messages at all? Also, I'm having a hard time fully understanding what it is you're trying to do... Care to explain a little further?
__________________
____________________________________________ Developer Shed Weekly Writer | DevArticles Forum Moderator Build Your Own KlipFolio Klip With PHP FrankManno.com - Under Construction Design Interactive Group - Under Construction |
|
#3
|
|||
|
|||
|
basically i just want to put a picture on every post..but make it different
|
|
#4
|
||||
|
||||
|
Have you thought about looking at some code that will randomly pick a picture out of a database maybe when you refresh?
|
|
#5
|
|||
|
|||
|
the problem is i dont have access to a database...i want to either manually upload a file or have it uploaded and call to it when i need it to display...i just dont know how
|
|
#6
|
|||
|
|||
|
Well, you have a few options... You don't necessarily need access to a database to achieve it.
In order to upload the file, you'll need to make use of PHP's file functions... There's a good article on dealing with BLOBBING data to a database. Don't worry about how it interfaces with the database... What you should do is understand how the file manipulation is being done via the FORM... once the file is uploaded, you can use PHP's fopen() to open a file and write binary data to it. As for randomizing the image on each page load, you can use Javascript to achieve that. If you need help with that portion, let us know... |
|
#7
|
|||
|
|||
|
i dont want to randomize it i want to be able to select it...and wheres the article...i alraedy know how to use ()fopen because i used a Matt Wades tutorial on news posting...
|
|
#8
|
|||
|
|||
|
sorry...the problem is that i dont know how to select a picture instead of text
|
|
#9
|
||||
|
||||
|
I think I get what you're wanting: A guild user should be able to browse a directory for a single picture to insert into his profile. Here's some code that'll read image files in from a given directory and output a select box containing those values. If this isn't exactly what you need, you should be able to modify it pretty easily to suit your needs.
PHP Code:
|
|
#10
|
|||
|
|||
|
k i get it but how do i display it i cant find a variable to display...i have 2 files one does th posting and one does the showing...sorry i feal like im asking too much...but so far what you have showed me it works i just want to get it showing..
![]() |
|
#11
|
||||
|
||||
|
Well, when you write to your flat file in the posting script, you'll want to add an item that's the name of the image selected by appending a "|" and the value of the select box to the end of the line. Then, when you display the page from your showing script, you'll just wrap the <img src=""> tag around the value given in the flat file.
Is it the case that you don't know how to read the flat file from the showing script? If so, just open the file and get the lines into an array. Then, for each line, use split() or explode() to split the values on the pipe character and put them into an array. You can then do a comparison of member id or name or whatever against the value in the appropriate array index to display the rest of the values. The more news items added, the bigger your file's going to be and the less efficient searching will be. Here's some pseudo code: PHP Code:
Here you can see, of course, that if you have multiple items submitted on a given date, you'll have problems selecting single articles out of the file. You really ought to include an auto-incrementing unique field to prevent these problems. |
|
#12
|
|||
|
|||
|
sorry for the confusion but im not trying to search for the picture im just trying to diplay it...select..then display it..... maybe this would be easier if i showed you the code... ive applied what you have given me but cant seem to display the picture =[ PHP Code:
|