News:

Join the Facebook Fan Page.

Main Menu

Attachment Alignment

Started by abadaba, June 02, 2010, 08:19:59 PM

Previous topic - Next topic

abadaba

Is there any possibility to have picture attachments to align left to right? Instead of having them stack on top of each other. This creates an issue when someone post 5+ pictures and they stack on top of one another within thumbs.

see the screen///

abadaba

Bump...Does anyone have any ideas?

abadaba

Has nobody ever ran across this? I don't mean to keep bumping the thread. But i need some help on figuring out how to align pictures within post from left to right instead of stacked.

Yağız...

Find in ./Themes/default/Display.template.php:
        // Assuming there are attachments...
        if (!empty($message['attachment']))
        {
            echo '
                            <div id="msg_', $message['id'], '_footer" class="attachments smalltext">
                                <div style="overflow: ', $context['browser']['is_firefox'] ? 'visible' : 'auto', ';">';

            $last_approved_state = 1;
            foreach ($message['attachment'] as $attachment)
            {
                // Show a special box for unapproved attachments...
                if ($attachment['is_approved'] != $last_approved_state)
                {
                    $last_approved_state = 0;
                    echo '
                                    <fieldset>
                                        <legend>', $txt['attach_awaiting_approve'], '&nbsp;[<a href="', $scripturl, '?action=attachapprove;sa=all;mid=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve_all'], '</a>]</legend>';
                }

                if ($attachment['is_image'])
                {
                    if ($attachment['thumbnail']['has_thumb'])
                        echo '
                                        <a href="', $attachment['href'], ';image" id="link_', $attachment['id'], '" onclick="', $attachment['thumbnail']['javascript'], '"><img src="', $attachment['thumbnail']['href'], '" alt="" id="thumb_', $attachment['id'], '" border="0" /></a><br />';
                    else
                        echo '
                                        <img src="' . $attachment['href'] . ';image" alt="" width="' . $attachment['width'] . '" height="' . $attachment['height'] . '" border="0" /><br />';
                }
                echo '
                                        <a href="' . $attachment['href'] . '"><img src="' . $settings['images_url'] . '/icons/clip.gif" align="middle" alt="*" border="0" />&nbsp;' . $attachment['name'] . '</a> ';

                if (!$attachment['is_approved'])
                    echo '
                                        [<a href="', $scripturl, '?action=attachapprove;sa=approve;aid=', $attachment['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve'], '</a>]&nbsp;|&nbsp;[<a href="', $scripturl, '?action=attachapprove;sa=reject;aid=', $attachment['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['delete'], '</a>] ';
                echo '
                                        (', $attachment['size'], ($attachment['is_image'] ? ', ' . $attachment['real_width'] . 'x' . $attachment['real_height'] . ' - ' . $txt['attach_viewed'] : ' - ' . $txt['attach_downloaded']) . ' ' . $attachment['downloads'] . ' ' . $txt['attach_times'] . '.)<br />';
            }

            // If we had unapproved attachments clean up.
            if ($last_approved_state == 0)
                echo '
                                    </fieldset>';

            echo '
                                </div>
                            </div>';
        }

Replace with:
        // Assuming there are attachments...
        if (!empty($message['attachment']))
        {
            echo '
                            <div id="msg_', $message['id'], '_footer" class="attachments smalltext">
                                <div style="overflow: ', $context['browser']['is_firefox'] ? 'visible' : 'auto', ';">
                                    <table>
                                        <tr>';

            $last_approved_state = 1;
            $i = 1;
            foreach ($message['attachment'] as $attachment)
            {
                $i++;
                echo '
                                            <td>';
                // Show a special box for unapproved attachments...
                if ($attachment['is_approved'] != $last_approved_state)
                {
                    $last_approved_state = 0;
                    echo '
                                    <fieldset>
                                        <legend>', $txt['attach_awaiting_approve'], '&nbsp;[<a href="', $scripturl, '?action=attachapprove;sa=all;mid=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve_all'], '</a>]</legend>';
                }
                if ($attachment['is_image'])
                {
                    if ($attachment['thumbnail']['has_thumb'])
                        echo '
                                                <a href="', $attachment['href'], ';image" id="link_', $attachment['id'], '" onclick="', $attachment['thumbnail']['javascript'], '"><img src="', $attachment['thumbnail']['href'], '" alt="" id="thumb_', $attachment['id'], '" border="0" /></a><br />';
                    else
                        echo '
                                                <img src="' . $attachment['href'] . ';image" alt="" width="' . $attachment['width'] . '" height="' . $attachment['height'] . '" border="0" /><br />';
                }
                echo '
                                                <a href="' . $attachment['href'] . '"><img src="' . $settings['images_url'] . '/icons/clip.gif" align="middle" alt="*" border="0" />&nbsp;' . $attachment['name'] . '</a> ';

                if (!$attachment['is_approved'])
                    echo '
                                                [<a href="', $scripturl, '?action=attachapprove;sa=approve;aid=', $attachment['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve'], '</a>]&nbsp;|&nbsp;[<a href="', $scripturl, '?action=attachapprove;sa=reject;aid=', $attachment['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['delete'], '</a>] ';
                echo '
                                                (', $attachment['size'], ($attachment['is_image'] ? ', ' . $attachment['real_width'] . 'x' . $attachment['real_height'] . ' - ' . $txt['attach_viewed'] : ' - ' . $txt['attach_downloaded']) . ' ' . $attachment['downloads'] . ' ' . $txt['attach_times'] . '.)
                                            </td>';
                    if ($i == 4) {
                        echo '
                                        </tr><tr>';
                        $i = 1;
                    }
            }

            // If we had unapproved attachments clean up.
            if ($last_approved_state == 0)
                echo '
                                    </fieldset>';

            echo '
                                        </tr>
                                    </table>
                                </div>
                            </div>';
        }

I'm not sure if it's still working.

Antechinus

That wont work in 2.0. It will be invalid code as the 2.0 template does not contain any tables. There is a solution for this but I'll have to find it again. I was messing with it ages ago.

Yağız...

Quote from: Antechinus on June 04, 2010, 07:15:44 PM
That wont work in 2.0. It will be invalid code as the 2.0 template does not contain any tables. There is a solution for this but I'll have to find it again. I was messing with it ages ago.
I'm too lazy to do it with divs :P

YogiBear

SMF v2.1.3  Mods : Snow & Garland v1.4,  PHP  v.7.4.33

greyknight17

Has this issue been resolved now? Did you try using the mod mentioned earlier?

Advertisement: