Jump to content

Recommended Posts

Hey guy, first of All thanks for given this topic a go and replying to it ;)

 

Now, I new to the whole php scene and I only know some of the basics, yet I foolishly

Try to compile a script that Will allow users ón my page to upload a title, a link and an image

To my mysql server and then displaying All images in the database on the index page resized in table :o

Any suggestions or examples are welcome and would be much appreciated :)

 

Thanks in advance - kemmeo

Hey guy, first of All thanks for given this topic a go and replying to it ;)

 

Now, I new to the whole php scene and I only know some of the basics, yet I foolishly

Try to compile a script that Will allow users ón my page to upload a title, a link and an image

To my mysql server and then displaying All images in the database on the index page resized in table :o

Any suggestions or examples are welcome and would be much appreciated :)

 

Thanks in advance - kemmeo

 

If you want I can make a script to do this for you? But I recommend you upload the image to a folder on your server but put a record of the name of the image into a field in the table in the database. I have always found this easier than storing images in the actual database.  :)

Wow Jacbey, you will? ^^

That's almost too awesome to be true :)

I'd be really glad if you found the time to make the script for me, and please, if it's easier for you to just make the images go in a folder, by All means make Them dó that (:

 

I Think it's really awesome you guys reply this quickly.

Thanks a lot everyone!

That's really cool of you :)

 

to be specific, I'm asking for a script that;

Allows users to Uploads an image,

give the image a title,

and a link.

 

and then;

 

Display all images from the folder on index.php

image must be clickable with the user specified link.

the images must be resized to Width 214 and Height 317

and be in a table with 4 columns and unlimited rows.

 

The whole Idea behind my need for this script is that I want to make a site where people can promote their art.

so they upload their paintings, photo's whatever with a link to their website in it.

so that when people see a painting they like they can click it and get taken straight to the artist's website or a place they can buy the painting.

 

I hope I'm not demanding too much, and I'd really appreciate it if you could make this script for me :)

eeeehm.. :)

Database is called art and the table is called gallery.

but I thought you said you wanted to store the files in a folder and not a mysql database?

 

It's easier to save images on the disc, in folders, than it is to save them in a db.  All your tables need is a column specifying the path to the image.

if you want an easy to understand and even a fun book, Head first php & mysql is really nice. lots of pictures puzzles examples and little tests. Just like you follow a course from a cool teacher. Try it! (if your totally new that is)

http://www.developphp.com/list_php_video.php

 

The videos on that website made me the PHP semi-ok dude that I am today. I can now bang out exactly what you are asking for in about 2-3 hours...if even that long.

 

You are creating 3 pages, 2 tables, and a directory for each individual user. I would make one index page which displays every image in the system, another page for user specific images, and a final page for a users profile. Tables would be 1 for contact/profile information and another to hold the data for the uploaded art.

 

Once you go through the site I just posted and review the videos, you should be good to go. The guy teaching the stuff is extremely thorough and assumes anyone looking at the videos are EXTREMELY dumb lol. At times you will find yourself sighing at how lower-level he takes some of his explanations, but other times you will appreciate his sense of depth. Good luck!!

 

P.S. I wish the project I am working on was something a bit more simple. For a first project, I think I went a bit too complex.

Hey Bl4ckmajik

 

thanks for the link, extremely useful!

The website that I'm making will only consist of a few pages though and the structure's a lil different then what you describe.

there's going to be an Index page with all the uploaded artwork in sorted by date.

then there's going to be an upload page and an about us page.

that's it :)

 

no member area, no registration and no logins, cause artist's hate that sort of thing ;)

Hey Bl4ckmajik

 

thanks for the link, extremely useful!

The website that I'm making will only consist of a few pages though and the structure's a lil different then what you describe.

there's going to be an Index page with all the uploaded artwork in sorted by date.

then there's going to be an upload page and an about us page.

that's it :)

 

no member area, no registration and no logins, cause artist's hate that sort of thing ;)

 

That's awesome!!! I do a bit of artistry myself and I must say, you are quite correct when you say WE DESPISE LOGGING IN!!!! LOL

 

The artwork being sorted by date, all displayed on one page is not bad. Its going to come down to the way you display everything. I hate tables so I suggest you use divs and float them all left. This way, if you size it correctly, the line breaks will happen automatically. For example, if your container div is 100 and each image container is only 20, then you will have 5 images in each row. Make sure the image div and image display is inside the while loop so you only have to type it once.

 

$display_images = '';
while ($row = mysql_fetch_array($someSql)) {
     $image_name = $row['image_name'];

     $display_images .= '<div class="images">
                                          <img src="images/' . $image_name . ' />
                                    </div>
}

 

Then, in the page body, you would echo this out to display your divs. Make sure the class 'images' is sized properly and floating to the left.

 

<div id="image_container">
     <?php echo "$display_images" ?>
</div>

 

Lastly, make sure the ID image_container is whatever will generate a perfect number for your images. For example if you want 10 images to display per row, then make sure this is big enough for exactly 10 images. Assuming 20px width of each image, to have 10 images you need a div of EXACTLY 200px (10images * 20px each).

 

You will also want to make sure you date stamp all your uploaded artwork using either the function 'now()' or the date() function. Also when setting up your database be sure to use Date datatypes because you will need to perform date math when sorting by most recent date. The about us page should be pure HTML so thats a breeze. I will say, if users don't have to be logged in to upload things, then hackers could find your site and attempt an attack. Ensure nothing but image files can be uploaded which can be done using something like this...

 

$allowed = array("image/jpeg", "image/gif", "application/pdf");
if(!in_array($file_type, $allowed)) {
     //some error
}

 

Bl4ck Maj1k

 

I'm a visual poet. I am sure I don't need to explain this but that's when your poems are intertwined with imagery...its a method of expressing what you say and depicting what you see as you say it. A lot of artists (painters and poets) lack the ability to put what they do into either imagery (poets) or words (painters). The real message is truly found when you turn those images into words or vice versa.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.