UBB.Dev
Posted By: Ian_W Threads resizing pictures? :( - 07/07/2002 4:23 PM
Hi,

Just imported a number of users from UBB - copying their Avatar URL's over to the picture field. All display - however all the images are 48x48 in aize and Threads insists on re-sizing them to 80x80 - I can change the maximum size to 48x48 and they will display okay - but I was under the impression that the size in themes.inc.php was a maximum and not a forced size.

Just wondered why threads is making all avatar images (pictures) the same maximum size?

Ian
Posted By: msula Re: Threads resizing pictures? :( - 07/07/2002 4:52 PM
I have had similiar "weird" occurances with avatars in threads. Seems as if some people upload avatars just fine, and if they are smaller they aren't resized. Yet some people's avatars get very stretched and distored while others don't. *shrug* Not sure why it happens. I just tell people to try and resize them theirself then re-upload, but unfortunately most of my users aren't very computer savvy
Posted By: Dave_L_dup1 Re: Threads resizing pictures? :( - 07/07/2002 5:47 PM
I think it works like this:

The avatar dimensions only get stored in the database if the avatar is uploaded though My Home.

When the avatars are displayed, if the dimensions are present, they're used for the width and height attributes. Otherwise, the default dimensions from the theme settings are used for the width and height attributes.

The import script just stuffs the avatar URLs into the database. It doesn't set the dimensions.

You can use this query to see what's in the database:

SELECT U_Username,U_Picture,U_PicWidth,U_PicHeight
FROM w3t_Users
WHERE (U_Picture is not null and U_Picture <> '' and U_Picture <> 'http://')
OR (U_PicWidth is not null and U_PicWidth <> '')
OR (U_PicHeight is not null and U_PicHeight <> '')
Posted By: Ian_W Re: Threads resizing pictures? :( - 07/07/2002 5:58 PM
Thanks Dave - so basically as all the avatars are 48x48 all I need to do is to update all the width & heights to 48.

Any clues on the query required, as not all the users have images.

Ian
Posted By: Dave_L_dup1 Re: Threads resizing pictures? :( - 07/07/2002 6:11 PM
Do this first, and verify that the rows selected are the ones that you want to change:
SELECT U_Username,U_Picture,U_PicWidth,U_PicHeight
FROM w3t_Users
WHERE U_Picture is not null and U_Picture <> '' and U_Picture <> 'http://'

Then update them:
UPDATE w3t_Users
SET U_PicWidth = 48, U_PicHeight = 48
WHERE (U_Picture is not null and U_Picture <> '' and U_Picture <> 'http://')

Disclaimer: backup the database first.
Posted By: JustDave Re: Threads resizing pictures? :( - 07/07/2002 6:15 PM
Try this query:

UPDATE w3t_Users
SET U_PicWidth = '48', U_PicHeight = '48'
WHERE U_Picture IS NOT NULL
AND U_Picture NOT LIKE 'http://'



Hope that works.

(back up that database as always)



Edit note: looks like Dave_L beat me to the punch.
Posted By: Ian_W Re: Threads resizing pictures? :( - 07/07/2002 6:30 PM
Thanks guys.

Worked a treat - does anyone know an idiots guide to these various SQL commands so that I can learn the various options?

Ian
Posted By: WDSBriAnna Re: Threads resizing pictures? :( - 07/10/2002 6:38 AM
I'm having a slightly different problem...


My problem seems to be that the board is taking
code:
if ($picwidth && $picheight) {
$picsize = "width="$picwidth" height="$picheight"";
}
else {
$picsize = "width="{$theme['PictureWidth']}" height="{$theme['PictureHeight']}"";
}



in showflat.php and going to else everytime. My pic size in config is set to 65x75, but many users are uploading 50x50 pictures and the board is stretching them. It was working for a few days correctly, but now 'suddenly' they're all 65x75 including the ones added SINCE 'suddenly' occurred. I really don't know PHP or SQL very well, and am using very rusty coding skills to find the problem. Any suggestions?

My Board is here, if it helps.
Posted By: WDSBriAnna Re: Threads resizing pictures? :( - 07/10/2002 7:24 AM
Thanks for your help, Dave, but it's the on-site ones that I'm referring to.
Posted By: Dave_L_dup1 Re: Threads resizing pictures? :( - 07/10/2002 7:36 AM
1) Try using one of the SELECT queries I posted above to see what's in the database.

2) Try inserting immediately before the "if":
code:
echo "Username='$Username',picwidth='$picwidth',picheight='$picheight'<br>\n";

Posted By: WDSBriAnna Re: Threads resizing pictures? :( - 07/10/2002 7:44 AM
Whoops. My husband was chatting in my ear and I ran the update one instead...

Sigh.

At least now there's a good reason why they are all 65x75. (The admin is an idiot.) I'll have them re-upload, and I'll watch if the problem occurs again.

Thanks anyway.
Posted By: WDSBriAnna Re: Threads resizing pictures? :( - 07/12/2002 9:42 PM
Alright then! The problem has continued, but this time I noticed that the user had just changed their sig, so I did some testing.

I have determined the behavior that causes the bug.

1. A user uploads a pic smaller than my default, 50x50 for example.

2. The pic shows correctly, 50x50.

3. The user then goes to their home later and changes anything else in the profile, but leaves the pic alone. They hit submit.

4. The database resets the pic size to my default (65x75).

How do I keep editbasic.php from resetting the pic size if the user has not modified it?
Posted By: Ian_W Re: Threads resizing pictures? :( - 07/12/2002 10:08 PM
Yep I am getting that as well - I resized all images to 48x48 as that was the size I imported all avatars over from UBB in.

Now some images have returned to 80x80 which is the size I have left the maximum at.

Posted By: Rick Re: Threads resizing pictures? :( - 07/18/2002 6:17 PM
There were a variety of problems on this one. The next version will allow for either upload or linking to an image at the same time. With these changes it also fixes this bug.
© UBB.Developers