Hello,
I have the SMF Media Gallery block code working fine on my forum, but would like to get rid of the file name, posted by, views and all the wording around the images. My intent is to show just the images and nothing else. What do I need to remove from the code to do that? I tried to remove what I thought would do that, but it broke the block code. I have posted my working code below...Thanks......
global $sourcedir, $context, $txt, $galurl, $scripturl, $settings;
require_once($sourcedir . '/Subs-MGallery.php');
loadMGal_Settings();
if (loadlanguage('MGallery') == false)
loadLanguage('MGallery', 'english');
$items = getMediaItems(0, 4, 'rand()');
echo '
<center><table border="0">
<tr>';
foreach ($items as $item)
echo '
<td>
<div class="smalltext" style="text-align: center; line-height: 1.4em; border: 1px #000000 solid; padding: 5px;">
<a href="',$galurl,'sa=item;id=',$item['id'],'">',$item['title'],'</a><br />
<a href="',$galurl,'sa=item;id=',$item['id'],'"><img alt="" src="',$galurl,'sa=media;id=',$item['id'],';thumb" alt="" /></a><br />
',$txt['mgallery_views'],': ',$item['views'],'<br />
',$txt['mgallery_posted_by'],': <a href="',$scripturl,'?action=profile;u=',$item['poster_id'],'">',$item['poster_name'],'</a><br />
',$txt['mgallery_in_album'],': <a href="',$galurl,'sa=album;id=',$item['id_album'],'">',$item['album_name'],'</a>
',$item['is_new'] ? '<br /><img alt="" src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" border="0" />' : '','
</div>
</td>';
echo '
</tr>
</table></center>';
Change
<div class="smalltext" style="text-align: center; line-height: 1.4em; border: 1px #000000 solid; padding: 5px;">
<a href="',$galurl,'sa=item;id=',$item['id'],'">',$item['title'],'</a><br />
<a href="',$galurl,'sa=item;id=',$item['id'],'"><img alt="" src="',$galurl,'sa=media;id=',$item['id'],';thumb" alt="" /></a><br />
',$txt['mgallery_views'],': ',$item['views'],'<br />
',$txt['mgallery_posted_by'],': <a href="',$scripturl,'?action=profile;u=',$item['poster_id'],'">',$item['poster_name'],'</a><br />
',$txt['mgallery_in_album'],': <a href="',$galurl,'sa=album;id=',$item['id_album'],'">',$item['album_name'],'</a>
',$item['is_new'] ? '<br /><img alt="" src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" border="0" />' : '','
</div>
to
<img alt="" src="',$galurl,'sa=media;id=',$item['id'],';thumb" alt="" />
If you want a link to the bigger picture (making an assumption that that's what the link would be to), make the change to
<a href="',$galurl,'sa=item;id=',$item['id'],'"><img alt="" src="',$galurl,'sa=media;id=',$item['id'],';thumb" alt="" /></a>
Boom. You nailed it. Just what I needed. Thank you very much. Greatly appreciated. If you ever find yourself in Northeastern PA or Galveston Tx, I'll buy ya a beer.
Scott
Houston, we have a problem...
The image block works fine in Firefox, but only red X's in IE, chrome or safari.....
Here is the code I modified, I am sure I must have botched something....
global $sourcedir, $context, $txt, $galurl, $scripturl, $settings;
require_once($sourcedir . '/Subs-MGallery.php');
loadMGal_Settings();
if (loadlanguage('MGallery') == false)
loadLanguage('MGallery', 'english');
$items = getMediaItems(0, 1, 'rand()');
echo '
<center><table border="0">
<tr>';
foreach ($items as $item)
echo '
<td>
<img alt="" src="',$galurl,'sa=media;id=',$item['id'],';thumb" alt="" />
</td>';
echo '
</tr>
</table></center>';
Remove one of the alt="" parameters in the <img> line as you have 2 in there. Take a look at the missing images in the other browsers, right click on them and choose properties. See if they are pointing to the same path and file name.
Thanks for the reply...
The path and file is the same, just in any other browser then firefox they show broken images.
I think the 2 alt="" parameters are ok, tested removing them and that did not help. They are (I think), for alternate text for the image and thumbnail?
Kind of an odd issue....
Did the original code work with all browsers?
No, the extra alt="" actually makes the HTML invalid if you try to validate it. You are only allowed a single alt attribute in an image. Please post a link to your problem.
JPDeni,
I actually have been going down the original code path. You are right, the original does not even work in anything other then firefox......Guess I need to test with all browsers before I open mouth....
So now I am stuck.
I will try to remove the alt tag again. Be back in a few.....
Thanks guys,
Scott
I removed the first
Quotealt=""
Still worked in firefox, but not in other browsers, still a broken image.....
It would help a lot if we could see it for ourselves. As IchBin suggested, a link would help.
Doh....
Here ya go.....
http://primedentaltech.com/BLOG/index.php
Thanks,
Scott
OK,
On to a permissions issue. I think that is what the problem is. My testing in other browsers I did not log in...
And that my friends, is my own dumb fault.
Rule 1001 of tech. When a problem is frustratingly flaky, check permissions....
Thanks,
ST
LOL!!! Live and learn. Sometimes it's the asking of the question that allows you to find your own answer. What matters is the end result.
Appreciate it. Still having issues. Really weird but now the images are intermittent in all browsers when not logged in.....Sometimes it shows an image or 2 and a few broken, sometimes it does not.
This is even weirder then maybe having bad block code....
Could it be that guests do not have permissions to access your gallery?
I set it, and removed access to guests a few times in both the block permissions and the gallery album permissions. Is there another location I need to double check?
Thanks,tt
Sco
I'm not talking about TP permissions. I'm only talking about the gallery permissions. I wouldn't have any idea about the gallery permissions, as I don't know anything about the gallery.