vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Avatar Resizing (https://vborg.vbsupport.ru/showthread.php?t=285731)

m002.p 07-19-2012 05:08 PM

Avatar Resizing
 
Hi guys,

Have a weird one here but I want to resize an avatar displayed using %. However, when doing it with the below method the image does not display.

Code:

<a href="profile.php?{$session[sessionurl]}do=editavatar"><img src="/forum/image.php?u={$bbuserinfo['userid']}" width="30%" height="30%"></a>
So, if this cant be solved, I was hoping it could be done with an edit to image.php allowing the use of height & width. For example:

Code:

/image.php?u=45&height=30%&width=30%
Any ideas how I can get either to work?

Matt

kh99 07-19-2012 07:06 PM

It seems to me like the first code you posted works. I'm not an html expert, but I think 30% could mean a different thing depending on where you put the code. Also, if a user has no avatar the image will be blank.

m002.p 07-19-2012 07:28 PM

Hi,

Thanks for your reply.

The code is used in a template on the forumhome.

The image with the first code simply does not show whereas change it to a pixel ie. width="200" works. It seems to be a problem with the percentage for the img tag.

peterska2 07-19-2012 10:13 PM

Quote:

Originally Posted by m002.p (Post 2349582)
Hi guys,

Have a weird one here but I want to resize an avatar displayed using %. However, when doing it with the below method the image does not display.

Code:

<a href="profile.php?{$session[sessionurl]}do=editavatar"><img src="/forum/image.php?u={$bbuserinfo['userid']}" width="30%" height="30%"></a>
So, if this cant be solved, I was hoping it could be done with an edit to image.php allowing the use of height & width. For example:

Code:

/image.php?u=45&height=30%&width=30%
Any ideas how I can get either to work?

Matt

I don't see any reason why the first one wouldn't work, but IIRC percentages and divs don't tend to play nice so might need to stick a single cell table in there. You shouldn't have { and } in vB3 templates either.

Try

Code:

<table border="0" cellpadding="0" cellspacing="0"><tr><td><a href="profile.php?$session[sessionurl]do=editavatar"><img src="/forum/image.php?u=$bbuserinfo[userid]" width="30%" height="30%"></a></td></tr></table>
Should do the trick if memory serves me correctly

Of course, this is working on the assumption that you already have the avatar displaying on forumhome without any resizing taking place.

kh99 07-19-2012 10:25 PM

Quote:

Originally Posted by peterska2 (Post 2349675)
...You shouldn't have { and } in vB3 templates either.

The curly braces are php "complex syntax", it allows you to use more "complex" variables in a string, like an array element with the key in quotes.

peterska2 07-19-2012 10:29 PM

Quote:

Originally Posted by kh99 (Post 2349678)
The curly braces are php "complex syntax", it allows you to use more "complex" variables in a string, like an array element with the key in quotes.

Yes, they are :) but they still don't belong there in this case ;)

kh99 07-19-2012 10:50 PM

Quote:

Originally Posted by peterska2 (Post 2349679)
Yes, they are :) but they still don't belong there in this case ;)

Not to make a big deal out of it, but I disagree - they "belong" there in the original code because there are quotes around the array key and it wouldn't work without the curly braces. You can remove the quotes as you did, but it doesn't mean the original code was wrong. Also, there are some situations where there's no other way to insert a variable, such as a multi-dimension array, an object, or if adjacent characters in the string would cause ambiguity. ;)

m002.p 07-20-2012 06:58 AM

Sorry to say but that code doesnt work either. The avatar simply does not display...

Cant get my head round it... change the height & width to pixels and it works fine.

Furthermore, no. The avatar does not already display on the forumhome Peterska. I am adding a welcome tempate to the top of the forumhome in vb3.

My only option may be hard coding it into the image.php file?

kh99 07-20-2012 10:36 AM

Which browser are you using? Can you show us a little more of the code around where you're putting it?

I don't think changing image.php would work because it wouldn't have any way to know what "30%" meant, and even if it did you would need to call a funciton to resize the mage.

m002.p 07-20-2012 07:56 PM

Yes here is the template. It is a modification of a welcome panel here on vb.org

Code:

<if condition="$vbulletin->options['onoff']">
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
        <td class="tcat" colspan="3" align="left">
                <a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('forumhome_welcomepanel')"><img id="collapseimg_forumhome_welcomepanel" src="$stylevar[imgdir_button]/collapse_tcat$vbcollapse[collapseimg_welcome_panel].gif" alt="" border="0" /></a>
<phrase 1="{$bbuserinfo['username']}">$vbphrase[wp_welcomeback]</phrase>
        </td>
</tr>
<tbody id="collapseobj_forumhome_welcomepanel" style="$vbcollapse[collapseobj_forumhome_welcomepanel]">
        <tr>
                <td class="alt1" align="center" width="1%">
                <table border="0" cellpadding="0" cellspacing="0"><tr><td><a href="profile.php?$session[sessionurl]do=editavatar"><img src="/forum/image.php?u=$bbuserinfo[userid]" width="30%" height="30%"></a></td></tr></table>
                </td>
                <td width="50%" class="alt2" align="$stylevar[left]" valign="top">
                <phrase 1="{$bbuserinfo['newposts']}" 2="{$bbuserinfo['newthreads']}" 3="{$bbuserinfo['lastvisit']}" 4="$timenow" 5="$datenow" 6="{$bbuserinfo['pmunread']}" 7="{$wp['newpostsplural']}" 8="{$wp['newthreadsplural']}">$vbphrase[wp_unread]</phrase>

<if condition="$vbulletin->options['rules']">
<br /><br />
<phrase 1="$vboptions[ruleid]">$vbphrase[wp_rules]</phrase>
</if>

<if condition="$vbulletin->options['showlatestannouncement']">
<br /><if condition="!$vbulletin->options['rules']"><br /></if>
<table border="0"><tr><td><img src="/forum/images/icons/icon4.gif"></td>
<td>
<phrase 1="$wp_forum_title" 2="$wp_latest_a_link" 3="$wp_latest_a_title">$vbphrase[wp_latestannouncement]</phrase>
</td>
</tr>
</table>
</if>
               

                </td>
                <td width="50%" class="alt1" align="$stylevar[left]" valign="top">
                <phrase 1="{$bbuserinfo['posts']}" 2="$wp_user_thread_count" 3="{$bbuserinfo['postsperday']}" 4="{$bbuserinfo['postpercent']}">$vbphrase[wp_user_stats]</phrase>
                <if condition="$bbuserinfo[active]">
                <b>&raquo;</b> $vbphrase[wp_activity] <a href="forumdisplay.php?{$session[sessionurl]}f={$bbuserinfo[active][0][forumid]}">{$bbuserinfo[active][0][title]}</a> $vbphrase[wp_activity2] <b>{$bbuserinfo[active][1]}</b> $vbphrase[wp_activity3].<br />
                <else />
                $vbphrase[wp_activity] <i>N/A</i><br />
                </if>

<!--BEGIN VB STATUS-->
<if condition="$vbulletin->options['vbstatus_active']">
<if condition="$bbuserinfo[vbstatus_status]">
<font size="1">$bbuserinfo[musername] {$vbulletin->options['vbstatus_statusprefix']}</font>
        <em id="vbstatus_$bbuserinfo[userid]">
        <font size="1"><i>$bbuserinfo[vbstatus_status]</i></font>
        <if condition="$bbuserinfo['userid']==$userinfo['userid'] OR is_member_of($bbuserinfo, 9, 10, 11)">
                        <a href="javascript:Att_Ajax('userid=$bbuserinfo[userid]&postid=$bbuserinfo[userid]','vbstatus/vbstatus_ajax.php')"><font size="1">Edit</font></a>
       
        </if>       
        </em>
<else />
<if condition="$bbuserinfo['userid']==$bbuserinfo['userid']">
                        <br /><br /><a href="javascript:Att_Ajax('userid=$bbuserinfo[userid]&postid=$bbuserinfo[userid]','vbstatus/vbstatus_ajax.php')"><font size="1">Add New Status</font></a>
       
        </if>       
</if>
</if>
<!--END VB STATUS-->
<br /><br />

                </td>
        </tr>
</tbody>
</table>
<br />
</if>

You can see the code in question near the top.

Well it would sure be possible to send just the GET vars to the php file to then add the % in the variable outputs in the php code?


All times are GMT. The time now is 02:32 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01494 seconds
  • Memory Usage 1,766KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (6)bbcode_code_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete