Topic: can someone help me code this right

    echo "<td><a href=\"".PUN_ROOT."gallery/".$file."\">".$file."</a></td>\n";

i want to replace the hyper link to a image link
i want a fixed size of 50px for both width and height.

width="50" height="50"

   

echo "<td><img src=\"".PUN_ROOT."gallery/".$file."\">"</td>\n";

Q

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

Re: can someone help me code this right

Try this peace of code:

echo '<td><a href="'.PUN_ROOT.'gallery/'.$file.'"><img width="50" height="50" src='.PUN_ROOT.'gallery/'.$file.'"></a></td>';

3 (edited by quaker 2009-04-15 13:05)

Re: can someone help me code this right

this is for the admin panel to upload photos. i dont need a hyper link in it. i just want to be able to show the photos

this is for my lightbox gallery script.

demo
http://bunpai.com/forum/gallery.php

it is a simple gallery script where you upload photo to a folder and it displays them.

Q

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

Re: can someone help me code this right

this is what im trying to do

echo "<td><img width="50" height="50" src=".PUN_ROOT."gallery/".$file."></td>\n";

but i get this error
Parse error: syntax error, unexpected T_LNUMBER, expecting ',' or ';' in /home/bunpaic/public_html/forum/plugins/AMP_Lightbox_Gallery.php on line 143

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

Re: can someone help me code this right

Sorry for the switch to single quotes, but I don't like using two [they confuse me for whatever reason].

    echo '<td><img width=\'50\' height=\'50\' src='.PUN_ROOT.'gallery/'.$file.'></td>\n';
If you need any PunBB 1.2.* mods done, feel free to send me a PM; we can work out a price [if need be].

6 (edited by MattF 2009-04-15 13:56)

Re: can someone help me code this right

Tieguy wrote:

Sorry for the switch to single quotes, but I don't like using two [they confuse me for whatever reason].

    echo '<td><img width=\'50\' height=\'50\' src='.PUN_ROOT.'gallery/'.$file.'></td>\n';

You do need the double-quotes for 1.1 strict validation, (I believe. Cant remember if single quotes are okay?). Best to put it as:

echo '<td><img width="50" height="50" src="'.PUN_ROOT.'gallery/'.$file.'"/></td>'."\n";

Re: can someone help me code this right

that works but it skips about for or 5 images...
hummm
here is the code that handles the images

    <?php

            $dirhandle = opendir(PUN_ROOT."gallery");

            while(false !== ($file = readdir($dirhandle)))

            {

                if($file == "." || $file == ".." || !($imagedata = @getimagesize(PUN_ROOT."gallery/".$file)))

                    continue;

                echo "<tr>\n";

                echo '<td><img width=\'50\' height=\'50\' src='.PUN_ROOT.'gallery/'.$file.'></td>\n';

                echo "<td>".$imagedata['mime']."</td>\n";

                echo "<td>".ceil(filesize(PUN_ROOT."gallery/".$file)/1024)." KB</td>\n";

                echo "<td>[ <a href=\"admin_loader.php?plugin=".$plugin."&amp;action=delete&amp;file=".$file."\">Delete</a> ]</td>\n";

                echo "</tr>\n";

            }

            ?>
My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

8

Re: can someone help me code this right

                if($file == "." || $file == ".." || !($imagedata = @getimagesize(PUN_ROOT."gallery/".$file)))

                    continue;

Re: can someone help me code this right

MattF wrote:
Tieguy wrote:

Sorry for the switch to single quotes, but I don't like using two [they confuse me for whatever reason].

    echo '<td><img width='50' height='50' src='.PUN_ROOT.'gallery/'.$file.'></td>
';

You do need the double-quotes for 1.1 strict validation, (I believe. Cant remember if single quotes are okay?). Best to put it as:

echo '<td><img width="50" height="50" src="'.PUN_ROOT.'gallery/'.$file.'"/></td>'."
";
Wikipedia wrote:

This contrasts with some earlier established traditions that began around the time of HTML 2.0, when many used uppercase tags. In XHTML, all attribute values must be enclosed by quotes; either single (') or double (") quotes may be used

Doesn't seem you need to, but no real reason not to.

If you need any PunBB 1.2.* mods done, feel free to send me a PM; we can work out a price [if need be].

10

Re: can someone help me code this right

what does that mean?

if someone will email me i will create them a admin account so they can see what im talking about..


Q

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

11 (edited by quaker 2009-04-15 14:40)

Re: can someone help me code this right

Mattf,Tieguy

that last code fixed it now all the images works

echo '<td><img width="50" height="50" src="'.PUN_ROOT.'gallery/'.$file.'"/></td>'."
";

Q

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

12

Re: can someone help me code this right

thanks...

here an image slice

http://i40.tinypic.com/2d9nu5j.jpg

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

13 (edited by MattF 2009-04-15 14:48)

Re: can someone help me code this right

Tieguy wrote:

Doesn't seem you need to, but no real reason not to.

I was becoming more dubious as to whether I was actually correct or not as I was typing that line, hence the last part. big_smile big_smile That one is obviously just me being pedantic again. big_smile big_smile

14

Re: can someone help me code this right

my next project for the gallery would be to add categories ...

main
-->photo
----->photo1
topic
-->level1
----->level2


categories must pull the first image in the directory for cat_img


anyone want to help with this?

Q

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

Re: can someone help me code this right

just dropped by to say hi. and i was just trying to learn html. and think im just a newbie..well guys gudluck with the codes

Re: can someone help me code this right

quaker wrote:

Mattf,Tieguy

that last code fixed it now all the images works

echo '<td><img width="50" height="50" src="'.PUN_ROOT.'gallery/'.$file.'"/></td>'."
";

Q

I had the same problem, and this fixed it as well. Thanks a lot.