News:

Wondering if this will always be free?  See why free is better.

Main Menu

Thumbnail on Topic Listing

Started by SMFHacks.com Team, April 04, 2008, 01:05:48 PM

Previous topic - Next topic

vbgamer45

Fixed. Did the full query change was hoping not to.
Was odd since it worked fine on my test site without that on mysql 5.7
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Doug Heffernan

Quote from: vbgamer45 on July 08, 2022, 12:25:33 PMFixed. Did the full query change was hoping not to.
Was odd since it worked fine on my test site without that on mysql 5.7

Beside the error reported by @@rjen, I got the column this and that isn't in GROUP BY type of error. I think that the reason you could not reproduce it is because the ONLY_FULL_GROUP_BY must be disabled on your mysql config, which makes said issue go unnoticed.

vbgamer45

Ah, yeah I was kind of surprised in my testing. was thinking i had to have to all the columns listed in the group by which I still think is strange.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

@rjen

Yep, now it is giving this error... so still not OK..

'smf2.ml.body' isn't in GROUP BY
File: C:\xampp\htdocs\vanilla\Sources\MessageIndex.php
Line: 361
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

Doug Heffernan

Quote from: @rjen on July 08, 2022, 03:25:07 PMYep, now it is giving this error... so still not OK..

'smf2.ml.body' isn't in GROUP BY
File: C:\xampp\htdocs\vanilla\Sources\MessageIndex.php
Line: 361

I do not get that error on my testing on a brand new forum. Anyways, the thing is that all mods that add to the topic message index by way of queries, all their custom fieldSs) must be added to the GROUP BY clause in the query I posted above.

As it happens, a while ago I got the same issue with another mod that I was testing. What mods do you have that add to the topic message index list if I may ask?

vbgamer45

Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

@rjen

Quote from: vbgamer45 on July 08, 2022, 04:28:37 PM@rjen  check if this version helps


That fixes the errors.

But tbh I have some concerns with regard to the thumbnail sizes and margings...
Image are being distorted. I think a height:"auto"  would be better... and some margin on the right to separate the text from the images...

Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

vbgamer45

Let me know what style to apply and can set a style tag on the images.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

@rjen

Quote from: vbgamer45 on July 08, 2022, 05:54:18 PMLet me know what style to apply and can set a style tag on the images.

Sorry, had a quick look but since I am not planning to use the Mod myself I will leave it up to you...

By the way: there is more that needs attention:
The option to activate the icons in the boards setting is not functional:
 
Thumbnails:
Display an thumbnail attachment that is attached to the first post of a topic

All boards are showing thumbnails on install, and the option is not set...
Trying to set the option does not work: the setting is not saved...
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

vbgamer45

4.0A
!Fixed in SMF 2.1.x setting to stay checked when enabling thumbnails on a board.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

AlanDewey

:-( 

SMF 2.1.2

from the admin error log....

QuoteDatabase Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.big.height, thn.filename, thn.width, thn.height, mf.body, id_board
            ORDER BY ' at line 38

MYSQL80
version 8.0.15
compiled for Win64

Other mods installed:
       google analytics  1.6
    Image for Anti-Spam Verification Questions  1.2
       Simple Audio Video Embedder    6.0.6

After running "uninstall" everything is back to normal.

Your mod worked fantastic with 2.0.18 etc
Causing lots of electrons to push each other around since 1985.

vbgamer45

Posted another update hopefully fixes it @AlanDewey
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

AlanDewey

#552
Working perfectly now.

THANK YOU !
Causing lots of electrons to push each other around since 1985.

AlanDewey

Ooops.... spoke too soon.

It works perfectly when I am logged in.

When not logged in, people get http 500 errors

error log....

Quotec79435b8e30163aaabf06d4bf38508ae
https://www.ccsforum.com/index.php?board=32.0
C:/inetpub/wwwroot/www.ccsforum.com/Sources/MessageIndex.php (Line 397)


Database Error: Unknown column 'lt.id_msg' in 'group statement'

Uninstall went flawlessly.  Forum working fine without the mod.
Causing lots of electrons to push each other around since 1985.

vbgamer45

Fixed that bug and

Version 4.1
!Hide thumbnail column if users don't have permissions to view attachments
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

AlanDewey

Working perfectly now.   :)  :D  ;D  :laugh:
Causing lots of electrons to push each other around since 1985.

@rjen

Just did some checking on SMF2.1 because the images were getting distorted all the time.
It seems that you have ported some 2.0 behaviour regarding sizes of the images that does not work in 2.1.

First it did not allow me to set all images to a fixed width without setting a fixed height too, causing all images to be disorted.

Then on smaller screens is would always distort images and on mobile the images would be hidden.

Changed this code in MessageIndex.template.php

// Thumbnail Topic Mod
if ($context['show_thumbnails'])
{
global $modSettings;
echo '<div class="lastpost">';

$imagefound = false;

foreach ($topic['image'] as $image)
{
if ($imagefound == true)
break;

if (isset($image['id']))
{
if (empty($modSettings['topic_thumb_width']) || empty($modSettings['topic_thumb_height']))
{
if ($image['bbcimg'] == false)
echo '<a href="', $topic['first_post']['href'], '"><img src="', $image['url'], '" width="', $image['width'], '" height="', $image['height'], '" alt="" /></a>';
else
echo '<a href="', $topic['first_post']['href'], '"><img src="', $image['url'], '" alt="" /></a>';
}
else
{

echo '<a href="', $topic['first_post']['href'], '"><img src="', $image['url'], '" width="', $modSettings['topic_thumb_width'], '" height="', $modSettings['topic_thumb_height'], '" alt="" /></a>';

}

$imagefound = true;
}

}

echo '</div>';
}

// End Thumbnail Topic Mod

To this...
// Thumbnail Topic Mod
if ($context['show_thumbnails'])
{
global $modSettings;
echo '<div style="margin-right:5px;">';

$imagefound = false;

foreach ($topic['image'] as $image)
{
if ($imagefound == true)
break;

if (isset($image['id']))
{
if (empty($modSettings['topic_thumb_width']) && empty($modSettings['topic_thumb_height']))
{
echo '<a href="', $topic['first_post']['href'], '"><img src="', $image['url'], '" alt="" /></a>';
}
if (empty($modSettings['topic_thumb_width']) && !empty($modSettings['topic_thumb_height']))
{
echo '<a href="', $topic['first_post']['href'], '"><img src="', $image['url'], '" height="', $modSettings['topic_thumb_height'], '" alt="" /></a>';
}
if (!empty($modSettings['topic_thumb_width']) && empty($modSettings['topic_thumb_height']))
{
echo '<a href="', $topic['first_post']['href'], '"><img src="', $image['url'], '" width="', $modSettings['topic_thumb_width'], '" alt="" /></a>';
}
else
{
echo '<a href="', $topic['first_post']['href'], '"><img src="', $image['url'], '" width="', $modSettings['topic_thumb_width'], '" height="', $modSettings['topic_thumb_height'], '" alt="" /></a>';
}

$imagefound = true;
}

}

echo '</div>';
}

// End Thumbnail Topic Mod

Now the images will always keep their aspect ratio, unless you specifically set the width AND height in the settings.

Secondly if you want all images to have the same width, only set the width and leave the height 0.
Setting a fixed height works the same way

... the messageindex does not leave empty space on the topics without images

and it also sjhows on mobile...


Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

vbgamer45

Posted update with the fix. I am not great with styling/css mainly copy and paste what I see works and use that.

Version 4.2
!Fixes for image distortion and styling for SMF 2.1.X thanks to @rjen
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Diego Andrés

It's missing some columns in the group by for the attachments.

On any theme even without adding the logic for the avatars, set
$settings['avatars_on_indexes'] = true;
 and the mod will fail in the messageindex.

Reported here by @rjen

I added af.id_attach and al.id_attach and it fixed it, not sure if that's it.

SMF Tricks - Free & Premium Responsive Themes for SMF.

vbgamer45

Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Advertisement: