Firefox PHP

Module: User Avatar

Posted by Maurice Makaay 
Re: Module: User Avatar
November 14, 2008 04:28PM
So the code you gave me would print out the number 4, or am I completely off?

$avatar_id = 4;

avatar_id seems to contain nothing when I try to write it out...
Re: Module: User Avatar
November 14, 2008 04:30PM
you have to strip the P_SER: in front of the serialized code.


Thomas Seifert
Phorum Development Team / Mysnip-Solutions.de
Custom Phorum and general software development
worry-free Phorum Hosting
Re: Module: User Avatar
November 14, 2008 04:43PM
Now I got it to work :), I get out the number 4 with the $avatar_id. But it seems that i cant use: /phorum/file.php?file=4 must I include som files to work with this file or something?
Re: Module: User Avatar
November 16, 2008 07:38AM
Hey,

i want to use users avatar pictures on my index page,

Language: PHP
$query = mysql_query("SELECT * FROM phorum_files WHERE link=';avatar'; AND user_id=';$user_id'; LIMIT 1"); while ($r1 = mysql_fetch_array($query)) { print("<img src=\"phorum/file.php?0,file=" . $r1[';file_id';] . ",filename=" . $r1[';filename';] . "\" />"); }


i tried those codes, i cant see the image on page but i can see with right clicking - and "show image" option.



but i cant show the image on panel


thanks,



Edited 4 time(s). Last edit at 11/16/2008 09:04AM by jeem.
Re: Module: User Avatar
November 16, 2008 12:55PM
Check the setting "Allow Linking To Uploaded Files" from the "General Settings" section in the Phorum admin. If that is not set to "From any website", then check if setting it to that option changes things for you.

The code in general looks okay to me. You might want to use urlencode($r1['filename']) instead of plain $r1['filename'] to make sure that special characters are escaped correctly in the URL.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Module: User Avatar
November 16, 2008 01:09PM
after allowing it works good, thanks for helping
Re: Module: User Avatar
December 14, 2008 07:41PM
Is there any way that you could incorporate 'convert' into this for resizing? I currently have a home rolled hack/module that I use so users can upload their picture. I'm probably going to borrow a bit of code from this module so that they can upload more than 1 photo, delete old ones (Currently you can only upload a photo to remove the current one).

However my end users are not the brightest computer users and if I told them that their photo had to be such that the longest edge was 600px and had to be in a jpg format, I don't know if I'd ever get photos. Some guys tried uploading BMPs huge photos, etc.

My host has ImageMagick installed, so I use the convert program to scale images to 600 if they are larger. I was playing with this in the avatar module and it wouldn't be too hard to add. Just add a check box for "Resize" and then a box for a link to the convert binary. Then some logic, "If resize is enabled, do resize".

Language: PHP
$new_file = tempnam("/tmp/","upload_").".jpg"; $command = "/usr/bin/convert -thumbnail ';600x600>';" . " ';" . $_FILES[';pict';][';tmp_name';] . "'; ';" . $new_file . "';";
Re: Module: User Avatar
December 14, 2008 07:56PM
For creating thumnails, I started the image API in include/api/image.php, to have a generic image scaling library that can be used from any module that needs image processing. I'm planning on putting the resizing in the avatar module. Maybe even some extra nice tool like cropping, which is not too hard if the image processing backend tools are available on the server.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Module: User Avatar
January 30, 2009 09:49AM
I just upgrade my 5.2.9a phorum to 5.2.10 version. All is OK, but my mod Avatar don't work. In ../templates/emerald/read.tpl I add
<td style="padding-right:10px">
{IF MESSAGES->user_avatar}
<img src="{MESSAGES->user_avatar}" alt="avatar"
{IF MESSAGES->user_avatar_w}
style="width:{MESSAGES->user_avatar_w}px;
height:{MESSAGES->user_avatar_h}px"
{/IF} />
{/IF}
</td>
as it was in the old phorum.
Please, help me!
Re: Module: User Avatar
January 30, 2009 04:05PM
Same here...
Sorry, only registered users may post in this forum.

Click here to login