altoyes posted on 2008-04-04 00:13:30 #
hi olaf and all
thankyou for your time
i am using the Easy PhP Upload script downloaded from here
It works well for me, thankyou. I have in the database all the images i have uploaded.
i am using it in conjunction with the User Access Class downloaded from here
HOW TO display the images on the webpage?
Do you have a script made already?
The most popular forum posts:
Comments / discussions
Olaf posted on 2008-04-04 04:15:35 #
?
just show an image tag (you need to insert the image name after upload, check the db example)
altoyes posted on 2008-04-04 05:11:31 #
hi olaf
thankyou for your reply
just show an image tag (you need to insert the image name after upload, check the db example)
yes i have that db example working here
and all your examples here
QUESTION:
as you directed i have checked the db example.
what does this mean?
just show an image tag (you need to insert the image name after upload
Olaf posted on 2008-04-04 05:46:34 #
- Upload the image with the example from the upload class
- Query the database for that image name
- Use that dynamic name in your image html
altoyes posted on 2008-04-04 06:00:51 #
1 i have uploaded the image.
QUESTION
2 How do i "Query the database for that image name"?
Do i hardcode a query into the upload_db_example.php
Olaf posted on 2008-04-04 06:11:28 #
do you have any knwoledge in PHP or MySQL?
check this PHP manual for the following functions:
mysql_query()
mysql_fetch_object() or mysql_fetch_assoc()
altoyes posted on 2008-04-04 06:26:54 #
yes, i do know how to query in mysql and php
what does your output look like?
might you have an example?
this is what mine looks like - no image, just the name of the renamed file
QUESTION
how do i get the image to show instead of the renamed image file?
Olaf posted on 2008-04-04 06:52:16 #
...maybe I think to simple:
$res = mysql_query($sql);
$obj = mysql_fetch_object($res);
echo '<img src="yourFolder/'.$obj->uploaded_image.'" alt="" />';
altoyes posted on 2008-04-04 07:23:00 #
ok i will give it a go
this looks tricky
Olaf posted on 2008-04-04 07:33:34 #
Quote from: altoyes
"ok i will give it a go
this looks tricky"
beginners PHP knowledge ;)
you should read a book or something, you need to know much more if your work with PHP classes
altoyes posted on 2008-04-04 07:39:20 #
olaf, yes i will read a book
thankyou for your time
do you have an example of what the image display looks like?
could you have a look as i get an error
Olaf posted on 2008-04-04 07:41:00 #
read the book and you will know whats wrong there ;)
altoyes posted on 2008-04-04 07:44:35 #
it is the object which i do find tricky
please tell me what i can use instead of object
i know it is easy
have you used this EXACT code example yourself?
OR do i need to change SOME of it?
do you have an example i could see?
Olaf posted on 2008-04-04 07:51:33 #
use an array mysql_fetch_assoc(), the php manual has examples for this function
altoyes posted on 2008-04-04 07:55:20 #
is there something wrong with my code?
QUESTION
should i put something INSTEAD of "uploaded_image" ?
=======================
THIS OUTPUTS alt=image INSTEAD of the actual IMAGE
$query = "SELECT * FROM file_table WHERE id=".$_GET['id'];
$res = mysql_query($sql);
$obj = mysql_fetch_array($res);
echo '<img src="/files/new/'.$obj->uploaded_image.'" alt="alt=image" />';
===========================
SO DOES THIS OUTPUTS alt=image INSTEAD of the actual IMAGE
$query = "SELECT * FROM file_table WHERE id=".$_GET['id'];
$result = mysql_query($query) or die('Error : ' . mysql_error());
while ($myrow = mysql_fetch_array($result));
$file_name=mysql_result($result,$myrow,"file_name");
echo '<img src="http://sistersahoy.com/files/new/'.$file_name->uploaded_image.'" alt="alt=image" />';
============================
Olaf posted on 2008-04-04 08:52:15 #
this is what I meant, you need to learn php first...
$res = mysql_query($sql);
$obj = mysql_fetch_array($res);
echo '<img src="/files/new/'.$obj['uploaded_image'].'" alt="alt=image" />';
altoyes posted on 2008-04-04 09:34:34 #
yes i do need to learn php
thank you for the amended code.
QUESTION
do i need to replace "uploaded_image" with something else?
Olaf posted on 2008-04-04 09:39:53 #
"uploaded_image" is the col name in your database table
altoyes posted on 2008-04-04 09:57:41 #
eureka, some results yes!
this is my mistake.
instead of $sql
$sql = "SELECT * FROM file_table WHERE id=".$_GET['id'];
$res = mysql_query($sql);
$obj = mysql_fetch_array($res);
echo '<img src="http://sistersahoy.com/files/new/'.$obj['file_name'].'" alt="alt=image" />';
i had $query
$query = "SELECT * FROM file_table WHERE id=".$_GET['id'];
$res = mysql_query($sql);
$obj = mysql_fetch_array($res);
echo '<img src="http://sistersahoy.com/files/new/'.$obj['file_name'].'" alt="alt=image" />';
altoyes posted on 2008-04-04 10:55:05 #
olaf:
i kiss you a thousand times
thankyou thankyou
AND it only took me 10 hours! that is a fast record for me.
alto
olaf, do you recommend links to free online for LEARNING PHP ? is php.net one of the best?
(FREE, as my internet work is nonprofit, my host is supplied free as the site is registered non-profit)
Olaf posted on 2008-04-04 11:21:03 #
Congrats!
yes start with the manual on php.net, use it with every function you like to use.
success!
altoyes posted on 2008-04-04 11:35:04 #
thankyou thankyou thankyou thankyou so much
thankyou so much for sticking with me as i know it is not your job to code for people, you do enough, more than enough by supplying scripts ...
thankyou you have no idea how much a relief this is to me ....
so long i have been toiling, trying to get one little BASIC APP happening for nonprofit community, for so long. this image upload is the last piece to the puzzle!
altoyes posted on 2008-04-06 09:17:00 #
hi olaf
have you by any chance combined the
upload_db_example.php
with the
foto_upload.php
so that ONLY thumbnails of uploaded images will appear on the webpage?
otherwise the images will be all different sizes AND too big or small as you can see here
Olaf posted on 2008-04-06 10:04:40 #
No, I don't have (you need to learn it while reading a book about PHP)
altoyes posted on 2008-04-06 10:30:09 #