1 edb Aug 07, 2008 19:07
3 edb Aug 08, 2008 03:16
Thanks!
um... I think you just took all the fun out of banging my head against a project ;)
4 sam2kb Aug 08, 2008 03:55
:)
I use this code on one of my sites. I can also give you the function to get a File object by item ID
5 sam2kb Aug 08, 2008 04:25
The function returns one image object for each item. The default mediaidx page doesn't allow you to break it on several pages and use prev/next links.
while( $Item = & mainlist_get_item() )
{
$File = & get_File_by_Item_ID( $Item->ID );
if( $File === false )
continue;
echo '<a href="'.$Item->get_permanent_url().'"><img
src="'.$File->get_thumb_url().'"
alt="'.$File->title.'"
title="'.$Item->title.'" /></a>';
}
// Get File by Item ID
function get_File_by_Item_ID( $Item_ID, $file_number = 0 )
{
$FileCache = & get_Cache( 'FileCache' );
$SQL = & new SQL();
$SQL->SELECT( 'link_ID, link_ltype_ID, file_ID, file_title, file_root_type, file_root_ID, file_path, file_alt, file_desc' );
$SQL->FROM( 'T_links LEFT JOIN T_files ON link_file_ID = file_ID' );
$SQL->WHERE( 'link_itm_ID = '.$Item_ID );
$SQL->ORDER_BY( 'link_ID' );
$Results = & new Results( $SQL->get(), 'link_' );
$Results->query( false, false, false );
$File = & $FileCache->get_by_ID( $Results->rows[$file_number]->file_ID, false, false );
if( !is_object($File) && !$File->is_image() )
return false;
return $File;
}
6 edb Aug 08, 2008 09:25
Okay this is starting to work. The function you shared above is now in inc/files/model/_file.funcs.php because anywhere else I got a "there ain't no function like that" error. I see where the first code in your last post makes a thumbnail linked to a permalink page, which I'm sure has value ... but not to me right now.
With the first bit of code you shared I'm getting an error due to it doesn't know what $imgSize is, which is probably why my popup is so freakin tiny. Since I'll be linking to images that are larger than the average nuclear war I'll probably just hardcode a 480 by 320 size or something like that, but I'll play with stuff to see what there is to see. Maybe code it to the dimensions of the photoblog resize? Maybe in a perfect world this link won't even show up if the original isn't larger than the resized image?
Way better than no access to the original file though!
BTW are you aware of this problem and solution? http://forums.b2evolution.net/viewtopic.php?t=15660 For those using the photoblog feature/skin I think it will be very handy to know of. In fact since I am now a photoblogger I'd best hack my own core eh?
EDIT: fixed the name of the file I hacked this into ;)
7 sam2kb Aug 08, 2008 11:44
The $imgSize variable is in my first post ;)
You can put this function in conf/_config_TEST.php
3264x2448 ยท 2.0 Мb
Display a direct link to image
Get image width and height
Image thumbnail with pop-up link