13:59 Mon Sep  3, 2007
Cheap Hummer!

12:18 Tue Jul  4, 2006
Hummer Camp After

12:15 Tue Jul  4, 2006
Hummer Camp

Help Me Humpa
PHP and MMS Server Help
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Show all pics by user?

 
Post new topic   Reply to topic    Help Me Humpa Forum Index -> MMS Pic Server by Humpa
View previous topic :: View next topic  
Author Message
Phree



Joined: 31 Dec 2005
Posts: 254
Location: South Coast, UK

PostPosted: Mon Mar 27, 2006 1:32 pm    Post subject: Show all pics by user? Reply with quote

Hey Humpa,

you don't seem to have many questions being asked at the moment Razz Laughing

I don't know if you remember my individual setup, but I have it so that someone can register on my site and they are then emailed a unique id. They then add that to the end of their MMS profile URL - http://www.mysite.com/mms/send.php?userid=12345678 and I then have a script that pulls that userid from the database and replaces it with their username under their MMS's - "Posted by: Humpa".

I'm wondering, is there any easy way of being able to pull up all the pics posted by an individual user? I'm trying to think of something like this:

For each MMS posted, there is a date&timestamp.txt file created with "Posted by: Username" - and with that file is the corresponding media. So somehow, if I wanted to show all pics from "Humpa", I'd need to examine all the .txt files on the server, find the ones that had "Humpa" in them and then have a page that showed all the media that related to those .txt files. (Of course, the .txt files have the same date&timestamp as the actual media files).

Firstly, does that make sense?
Secondly, is it easier to achieve than I'm thinking?
Thirdly, probably easier to tell me to sod off as you've already helped me more than enough Smile

Cheers!
Back to top
View user's profile Send private message
Phree



Joined: 31 Dec 2005
Posts: 254
Location: South Coast, UK

PostPosted: Tue May 15, 2007 7:18 pm    Post subject: Reply with quote

Hi Humpa,

not sure if you ever read the above post or not, but it's been something I've put on the back burner and every now and again, come back to. I'm looking at it again and trying to see if there's a way of achieving this easily. Apart from the thoughts I've had above, I'm wondering if I could somehow do this:

When a user sends media to the site, I add the filename and user to a separate table in my database...Then I somehow have the username as a hyperlink under their posted media (example: Posted by: Humpa) and that then takes them to another page that interrogates the database for all media posted by Humpa...Firstly, does that make sense? Secondly, could it work? Thirdly, I can add the data easily enough to the database, but not sure of the code I would need to then extract it again...I'm not too worried about having a "Humpa style" page when showing an individual users media, just a simple enough gallery showing all the pics (and possibly comments) etc...I'm sure you know what I mean Wink

Cheers - and I welcome any thoughts/ideas Cool
Back to top
View user's profile Send private message
Humpa
Site Admin


Joined: 06 Nov 2005
Posts: 10258

PostPosted: Tue May 15, 2007 8:08 pm    Post subject: Reply with quote

It really isn't designed for that.

Probably the easiest way is to log an entry in a new database table for every mms the user sends.
Just log his username and the $pic_time.
You could put the sql insert line right before the writeBackSendConf($dec); line to ensure you didn't log anything that wasn't actually an mms message that was sent.

But the problem would then be writing a page to pull those 14 digit pic_time's out of the database and turning them into a page(s) of that users pic/videos/whatever.

You'd have to copy the index.php, but totally rewrite it. It doesn't look very easy. Sad
Back to top
View user's profile Send private message
Phree



Joined: 31 Dec 2005
Posts: 254
Location: South Coast, UK

PostPosted: Tue May 15, 2007 8:59 pm    Post subject: Reply with quote

Hi,

thanks for the reply. I guess I'm just being dumb here, but would it not be possible to pull all the posted media by a user out of a database by using the userid? Let's say that my userid=001. So if a user was to click on my name, I'd have some kind of sql statement that would pull out all media where userid=001 ? By storing the actual filename of the media posted then it would pull out all the .jpg / .mp4 whatever. I wouldn't necessarily need to be able to hyperlink userid's, I could have a separate page that listed all my users and make those links...Or are you saying the problem would be how to display the media once pulled from the database?

I suppose another way, would be when a user joins my site, I could create a separate folder with their username and have the media copied to that folder...And then that page would simply be a 'display' page - they wouldn't be able to edit/delete or anything. Would that be easier you think? I can't remember from reading previous posts, but it's not that easy to copy media to two folders when media is sent to the site is it? If it is, then I could copy installs of Humpa-MMS (with the minimal amount of files needed) to users folders and they would then be in /mms/userid

Cheers Humpa - sorry for picking your brains over this, but it's a bit of a Star Wars scenario...Help me, Obi-Wan Kenobi; you're my only hope Laughing vader
Back to top
View user's profile Send private message
Humpa
Site Admin


Joined: 06 Nov 2005
Posts: 10258

PostPosted: Tue May 15, 2007 9:05 pm    Post subject: Reply with quote

The easiest thing would be to give them all separate folders. But then you wouldn't be able to show all pics together, only separted pages for each user.

Your best solution might be this:
You could put an sql insert line right before each $file = fopen($filename, 'wb'); line.
Just insert their userid in one column, the $filename in another, and the $pictime in another.

Then the problem would be simply writing some sort of page to display all that.
Back to top
View user's profile Send private message
Phree



Joined: 31 Dec 2005
Posts: 254
Location: South Coast, UK

PostPosted: Tue May 15, 2007 9:10 pm    Post subject: Reply with quote

Ok, I reckon that's the way to go. Let me know when you've finished coding it up?

Heh heh, only joking Smile I think what I might do for now, is just have a page that shows only the images and worry about other media/comments some other time...I think that might be the easiest thing to do for now.

Cheers Humpa!
Back to top
View user's profile Send private message
Phree



Joined: 31 Dec 2005
Posts: 254
Location: South Coast, UK

PostPosted: Wed May 16, 2007 7:46 pm    Post subject: Reply with quote

Goooooooooood evening Very Happy

Well I've been toying around with this a fair bit today and I think I'm real close to an answer. Couple of things I wouldn't mind a bit of help with though please...

Firstly a quick question about phpthumb. When you use this, do you have to specify width and height? If I have an original image of say 640x480, if I was to set the width & height to 80x80 then the thumbnail will obviously look squint. Is there a way for phpthumb to dynamically alter the size of the original without losing the perspective?

Secondly, here's a line of my code:
Code:

"<td><img src=$row[filename] width=100 height=100 alt=\""."\"></td>";


When displaying the images, it displays them horizontally - which is what I want...But I'm trying to work out how, after say 8 images, it drops to the next line. So rather than get all my images trailing left to right all the way across the screen, they appear in a neatly displayed table...

I've trawled through the lines of code in your MMS scripts but can't seem to tally them up. I looked at how you have displayed the media table on index.php but just can't seem to work it out...

Thanks a lot Mr H!
Back to top
View user's profile Send private message
Humpa
Site Admin


Joined: 06 Nov 2005
Posts: 10258

PostPosted: Wed May 16, 2007 7:51 pm    Post subject: Reply with quote

I forget how exactly phpthumb needs it's attributes, but I think you can just use a height or a width, and it will resize it proportionally. And if the pic is already smaller then the size you tell it, it won't resize at all.
But all that is explained in the file itself. Look in the phpThumb or the phpThumb config file. Those files have not been modified by me at all.

For displaying horizontally, you need to use multiple table cells before ending the row .. you know?
I imagine you know that, but the trick comes in setting up a counter in your script so it ends the table row every 5 pics and then starts a new row. I imagine you can use the code I have in the index.php already for that.
Back to top
View user's profile Send private message
Phree



Joined: 31 Dec 2005
Posts: 254
Location: South Coast, UK

PostPosted: Wed May 16, 2007 7:53 pm    Post subject: Reply with quote

Hi,

sorry about editing my post as you were replying...I shouldn't have done that. Surprised

Thanks though - I'm glad you said about index.php because it means I am on the right track to working this out...

Will let you know how I get on!
Back to top
View user's profile Send private message
Humpa
Site Admin


Joined: 06 Nov 2005
Posts: 10258

PostPosted: Wed May 16, 2007 8:00 pm    Post subject: Reply with quote

something like this:
Code:
$thumb_width = 100;
$num_columns = 7;

$table_count = 1;

$media_table .= "<table align=\"center\">\n<tr>\n";

$sql = "select * from mms_table where userid='$useid' order by pictime desc";
$result = mysql_query($sql);
while($row = mysql_fetch_array) {
   if($table_count ==  ($num_columns +1)) {
      $media_table .= "</tr>\n<tr>\n";
      $table_count = 1;
   }
   $media_table .= "\t<td align=\"center\">\n";
   
   $media_table .= "\t\t<img src=\"phpThumb.php?src=media\$row[filename]&w=$thumb_width\" alt=\"something\">\n";
   
   $media_table .= "\t</td>\n";

   $table_count++;
}
while($table_count < ($num_columns +1)) {
   $media_table .= "\n\t<td>&nbsp;</td>\n\n";
   $table_count++;
}
$media_table .= "</tr>\n</table>\n\n";

echo $media_table;
Back to top
View user's profile Send private message
Humpa
Site Admin


Joined: 06 Nov 2005
Posts: 10258

PostPosted: Wed May 16, 2007 8:04 pm    Post subject: Reply with quote

of course then you have the problem that it will show a zillion pics, if that user has a zillion pics Wink
Back to top
View user's profile Send private message
Phree



Joined: 31 Dec 2005
Posts: 254
Location: South Coast, UK

PostPosted: Wed May 16, 2007 8:49 pm    Post subject: Reply with quote

Thanks very much for the code...Although it seems to be looping? Here's the code (just omitting the database connection stuff):

Code:


$thumb_width = 100;
$num_columns = 7;

$table_count = 1;

$media_table .= "<table align=\"center\">\n<tr>\n";

$sql = mysql_query("select * from images order by user desc limit 10");
$result = mysql_query($sql);
while($row = mysql_fetch_array) {

   if($table_count ==  ($num_columns +1)) {
      $media_table .= "</tr>\n<tr>\n";
      $table_count = 1;
   }
   $media_table .= "\t<td align=\"center\">\n";
   
$media_table .= "\t\t<img src=\"phpThumb.php?src=$row[filename]>\n"; 

 
   $media_table .= "\t</td>\n";

   $table_count++;
}
while($table_count < ($num_columns +1)) {
   $media_table .= "\n\t<td>&nbsp;</td>\n\n";
   $table_count++;
}
$media_table .= "</tr>\n</table>\n\n";

echo $media_table;


I try that and just keep getting an error page saying page couldn't be loaded - not like there's an error with the code, but an error saying stuff like "Refresh page: Search for the page again by clicking the Refresh button. The timeout may have occurred due to Internet congestion. " - It's not happening on any of my other pages.
Back to top
View user's profile Send private message
Phree



Joined: 31 Dec 2005
Posts: 254
Location: South Coast, UK

PostPosted: Wed May 16, 2007 8:59 pm    Post subject: Reply with quote

Sorted!

I changed:
Code:

while($row = mysql_fetch_array) {

to
Code:

while ($row = mysql_fetch_assoc($sql)) {


And it works!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Help Me Humpa Forum Index -> MMS Pic Server by Humpa All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum