Pages (3):    1 2 3
Member
Member
thinkdreams   19-08-2006, 16:46
#21

Marc-

The thumbnails are no more than processed i.php images. So the procedure is as follows:

  1. SQL Query is made based on album and image
  2. Thumbnail or regular sized image?
  3. If Thumb, run through i.php and convert to thumb.
  4. If Image, run through i.php and convert (if necessary)
  5. Display.

Thus, resizing the photo happens after the SQL query. The database doesn't actually contain any thumbnails. The i.php takes the image from the DB and converts it to whatever size was asked for after the SQL query.

So, if you want to display only random thumbnails, then you need to size and crop the image as a thumb. There are a couple custom thumb functions in the template-functions.php you should be able to use to do a custom thumb and crop size.

Now, if you want to only randomize based on certain albums, then you will need to change the SQL query to include only those albums you want to gather to randomize. However, the SQL query will then need to be run through i.php.

This is hopefully what you were looking for, but if anyone else has any more suggestions, that would be cool too.

Member
Member
thinkdreams   19-08-2006, 21:21
#22

After looking at the database table, the field you are looking for is "thumb". That's what zenphoto is using to designate the album thumb to display. You could pull this field in a SQL query, and then randomize against that to accomplish what you want.

Member
Member
marc   19-08-2006, 22:49
#23

Yeah that is what I'm looking for. I just don't know how to write the SQL to pull out just images in the thumb column of the ablums table.

Member
Member
thinkdreams   19-08-2006, 23:07
#24

You may be able to add:

.prefix("album").'.thumb

to the select statement. Bear in mind my syntax may be off. Anyone else want to comment?

Member
Member
marc   19-08-2006, 23:22
#25

I think I got it. The only thing is that the thumb column is empty when you upload via FTP untill you pick and actual album thumb highlight. I guess it just defaults to to first picture if one isn't listed in the thumb column of the album table.

`function getRandomImage() {

$result = query_single_row('SELECT folder,thumb FROM '.prefix("albums").' ORDER BY RAND() LIMIT 1');

$image = new Image(new Album(new Gallery(), $result['folder']), $result['thumb']);

return $image;

}`

Pages (3):    1 2 3
  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.