Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Images

Image Loader

images php coding issues or problems here.

Moderators: macek, egami, gesf

Image Loader

Postby Alexm1 » Fri May 14, 2004 9:28 pm

A couple of friends worked this photo gallery out for me:
http://userpages.umbc.edu/~brett2/phpimageLoader/
I used the template to create
http://userpages.umbc.edu/~alexm1/photos/may.php
Nice, right? But try clicking on image 8, 9, or 19. Instead of the echo_image function, it follows the echo_thumbnail. I have tried going back from the tutorial template, but the same problem comes up. The posted source [(c) Paul Oliver 2004] is up on http://userpages.umbc.edu/~brett2/phpim ... final.html .

I am a newbie, and can't see a reason for this to fail the way it does.
Alexm1
New php-forum User
New php-forum User
 
Posts: 2
Joined: Fri May 14, 2004 9:21 pm

Postby swirlee » Fri May 14, 2004 10:47 pm

The link you posted is very poorly-written. I recommend that you go to HotScripts.com and browse their PHP Image Galleries section until you find a free script which meets your requirements.
User avatar
swirlee
Moderator
Moderator
 
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back

Postby Alexm1 » Sat May 15, 2004 7:24 am

Sorry, but how is it poorly written? Should I get out of PHP and write in HTML first?

<html>
<head>
<title></title>
<style></style>
</head>
<body>
<?

I'm looking through other free scripts and examples, but my question is why the imageloader works perfectly at http://userpages.umbc.edu/~brett2/phpim ... Loader.php but not at http://userpages.umbc.edu/~alexm1/photos/may.php when they use the same server, and the same script template.

Does it have to do with the first IF statement?
<?php
if(empty($_GET['img']))
{
echo_thumbnail();
exit;
}
else
{ ...

Is there a different way of creating the two functions?
Alexm1
New php-forum User
New php-forum User
 
Posts: 2
Joined: Fri May 14, 2004 9:21 pm

Postby swirlee » Sat May 15, 2004 9:31 am

Sorry, I didn't mean to insult, especially if you're a PHP beginner and wrote the code yourself. I was in a hurry when I replied to your post. I thought that you were using someone else's package, in which case I would have recommended something more robust. Basically I was trying to prevent you from reinventing the wheel. There are literally hundreds of image gallery scripts out there, at least one of which almost certainly meets your requirement.

Concerning your code, the trouble is that you mix data, logic, and presentation so heavily, that in the end your code will be very difficult to maintain. HTML should be kept separate from the PHP as much as possible, as should the data describing your images.

I know for newbies this is a troublesome concept, because most beginning PHP books and tutorials start out saying, "look how easy it is to mix PHP and HTML!"

Once again, I didn't mean to insult you and I hope I haven't discouraged you from using PHP or our forum. :)
User avatar
swirlee
Moderator
Moderator
 
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back


Return to PHP coding => Images

Who is online

Users browsing this forum: No registered users and 3 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.