PunBB Resource

Your ultimate PunBB resource!

Keywords:

    (Extended)

You are not logged in.

#1 2013-11-28 01:31:19

helpkoos
New member
Registered: 2013-11-28
Posts: 2

Automatic Image Upload fix

Hey Koos I have a request if you wouldn't mind giving me the fix, on your Image Upload script if the user has no uploads it shows a
completely empty page. Is there a way to echo "There are no images to display." if the user has not uploaded any images?


Also I appreciate you keeping PunBB 1.2 alive

Last edited by helpkoos (2013-11-28 01:33:32)

Offline

 

#2 2013-11-29 12:48:03

Koos
Administrator
Registered: 2007-01-14
Posts: 524
Website

Re: Automatic Image Upload fix

Try this:

Open: uploadimg_view.php

Find:

Code:

    } //end file loop
}

After, add:

Code:

else
    echo 'There are no images to display.';

Offline

 

#3 2013-12-01 22:08:12

helpkoos
New member
Registered: 2013-11-28
Posts: 2

Re: Automatic Image Upload fix

I am using an older version of your script that didn't tie in as plugin and I prefer this version also I did some tweaking. This old version doesn't have that comment and has a different "if" and "else" setup. Here is the code:

Code:

<?php

if (($_GET['view']) == "all")
{
    $rows = 3;
    $row = "0"; ?>
<script type="text/javascript">function highlight(a){a.focus();a.select()};</script>
<div class="block">
<h2><span>Images</span></h2>
<div class="box">
<div class="inbox">
<table>
<tr>
<?php
    $othernum = 0;
    $count = 0;
    $num_pages = ceil(count($file_array) / 9);
    if (!empty($_GET['p']))
    {
        $p = $_GET['p'];
    }
    else
    {
        $p = 1;
    }

    $mgf2 = (($p - 1) * 9) + 9;
    if ($mgf2 > count($file_array))
    {
        $mgf2 = count($file_array);
    }

    for ($y = (($p - 1) * 9); $y < $mgf2; $y++)
    {
        $count++;
        $filenm = $file_array[$y]->getfname();
        if (file_exists("$absolute_path_thumbs/$filenm"))
        {
            $getimg = "[img]" . $forumurl . $idir . $filenm . "[/img]";
            $geturi = "$forumurl$idir$filenm";
            $boxwidth = 150 - 4;
            if ($row == $rows)
            {
                echo "</tr>";
                {
                    echo "<tr><td class=\"galview\">" . "\n";
                    if ((in_array($mgf_user['g_title'], $allow_delete)) && ($showdel))
                    {
                        echo "<p><a href=\"gallery.php?view=all$addthis&amp;p=$p&amp;deletefile=" . $file_array[$y]->getfname() . "\">" . $lang_upload['Delete'] . "</a></p>" . "\n";
                    }

                    echo "<a href=\"" . $forumurl . $idir . $file_array[$y]->getfname() . "\"><img src=\"" . $forumurl . $tdir . $file_array[$y]->getfname() . "\" alt=\"\"></a><br>" . "\n" . "<table class=\"ingal\">" . "\n" . "<tr>" . "\n" . "<td class=\"galcode\"><strong>" . $lang_upload['Code'] . ":</strong></td>" . "\n" . "<td class=\"galcode\"><input onmouseup=\"highlight(this);\" onclick=\"highlight(this);\" value=\"" . $getimg . "\"></td>" . "\n" . "</tr>" . "\n" . "</table><br><br></td>" . "\n" . "";
                }

                $row = "1";
            }
            else
            {
                {
                    echo "<td class=\"galview\">" . "\n";
                    if ((in_array($mgf_user['g_title'], $allow_delete)) && ($showdel))
                    {
                        echo "<p><a href=\"gallery.php?view=all$addthis&amp;p=$p&amp;deletefile=" . $file_array[$y]->getfname() . "\">" . $lang_upload['Delete'] . "</a></p>" . "\n";
                    }

                    echo "<a href=\"" . $forumurl . $idir . $file_array[$y]->getfname() . "\"><img src=\"" . $forumurl . $tdir . $file_array[$y]->getfname() . "\" alt=\"\"></a><br>" . "\n" . "<table class=\"ingal\">" . "\n" . "<tr>" . "\n" . "<td class=\"galcode\"><strong>" . $lang_upload['Code'] . ":</strong></td>" . "\n" . "<td class=\"galcode\"><input onmouseup=\"highlight(this);\" onclick=\"highlight(this);\" value=\"" . $getimg . "\"></td>" . "\n" . "</tr>" . "\n" . "</table><br><br></td>" . "\n" . "";
                }

                $row++;
            }
        }
    }
    echo "</tr></table>
</div>
</div>
</div>"; ?>
<div class="linksb">
<div class="inbox">
<p class="pagelink">
<?php
    $paging_links = $lang_common['Pages'] . ': ' . paginate($num_pages, $p, 'gallery.php?view=all' . $addthis);
    echo $paging_links; ?>
</p>
</div>
</div>
<?php
} ?>
<?php
require MGF_ROOT . 'footer.php';
 ?>

Would you mind telling me where to add it?

Offline

 

#4 2013-12-05 16:44:15

Koos
Administrator
Registered: 2007-01-14
Posts: 524
Website

Re: Automatic Image Upload fix

Looks like you are running Automatic Image Upload with Thumbnails v1.2. In that case, try the following:

Open: uploadimg_view.php

Find:

Code:

echo "
</tr></table>
            </div>
        </div>
    </div>";

Before, add:

Code:

if (count($file_array) == 0)
    echo 'There are no images to display.';

Offline

 

Board footer

Based on PunBB
© Copyright 2002–2005 Rickard Andersson

© Copyright 2004–2006 Kristoffer Jansson

User contributed files are property of their respective owners.