CPMfetch for 1.5.6 - Page 6 CPMfetch for 1.5.6 - Page 6
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

CPMfetch for 1.5.6

Started by lurkalot, June 08, 2010, 11:35:18 PM

Previous topic - Next topic

0 Members and 5 Guests are viewing this topic.

ron4mac


ron4mac

Well ... it seems the 'subtitle' feature was not completed/implemented after some other structure changes in 2.1.1.

Where to go from here?  It wasn't my intent to get involved in the functionality/features of CPMfetch .. only to make it compatible with modern PHP, etc.  In looking over 2.0.0 and 2.1.1 ... they both need a LOT of work.

gmc

How extensive were the changes to 2.1.1 to make it compatible with PHP7/CPG 1.6?
Maybe we do a 2.0.1 and a 2.1.2 - one from each - until someone has time to put more work into it??

Been on my list to look at - but time has been scarce for me.
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

ron4mac

Quote from: gmc on May 31, 2017, 04:00:20 PM
How extensive were the changes to 2.1.1 to make it compatible with PHP7/CPG 1.6?
Maybe we do a 2.0.1 and a 2.1.2 - one from each - until someone has time to put more work into it??
I won't be involved with two versions. I'll add 'subtitle' support to the version I already updated (2.2).

lurkalot

Quote from: ron4mac on May 31, 2017, 02:51:23 PM
Well ... it seems the 'subtitle' feature was not completed/implemented after some other structure changes in 2.1.1.

Where to go from here?  It wasn't my intent to get involved in the functionality/features of CPMfetch .. only to make it compatible with modern PHP, etc.  In looking over 2.0.0 and 2.1.1 ... they both need a LOT of work.

The functionality was fine in 2.0.0, it was just the depreciated errors that were causing concern. In my opinion 2.0.0 should have been the one updated to fix the depreciated errors, as this was the finished / stable release.  2.1.1 was a WIP which wasn't finished as far as I can see. That's one of the reasons I asked vuud if we could modify and release cpmfetch 2.0.0 for coppermine 1.5.x to which he agreed.

I have no idea what the difference is between the two versions, or whether they should behave in the same way. all I know is 2.1.1 doesn't workproperly, and 2.0.0 does, apart from those depreciated errors.
Running SMF 2.1.4  / Tinyportal 3.0.1, bridged with Coppermine 1.6.25, plus cpmfetch 2.0.0

phill104

Iirc, it still needed a lot of work to finish.
It is a mistake to think you can solve any major problems just with potatoes.

ron4mac

Quote from: lurkalot on May 31, 2017, 06:51:05 PM
In my opinion 2.0.0 should have been the one updated

Find version 2.0.1 in original post.
( removed 2.2 )

lurkalot

Quote from: ron4mac on June 02, 2017, 01:50:32 AM
Find version 2.0.1 in original post.
( removed 2.2 )

Excellent, works nicely, no errors so far.  thank you.   
Running SMF 2.1.4  / Tinyportal 3.0.1, bridged with Coppermine 1.6.25, plus cpmfetch 2.0.0

gmc

Well... the reason there were two versions was different things worked in the different versions...
I can't use 2.0.x - as the remote support (cfimageget) doesn't work... It was not reworked for V2 until 2.1.1.

Didn't know till now that there was other items working in 2.0 that were 'broken' in 2.1.1... From notes just appeared to be fixes and additions.
But was still a developers release - so obviously wasn't fully tested/completed.

Obviously some effort will be needed to properly merge all the functions... But would be nice to support both 'flavors' until then.
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

lurkalot

Any way to make cpmfetch work responsively?  I'm testing in our new Tinyportal Responsive version, in a center block.  Everything else seems to resize and stack, but not the latest images block, it just cuts it off and add a scrollbar.
Running SMF 2.1.4  / Tinyportal 3.0.1, bridged with Coppermine 1.6.25, plus cpmfetch 2.0.0

gmc

Quote from: lurkalot on February 12, 2018, 12:25:47 AM
Any way to make cpmfetch work responsively?  I'm testing in our new Tinyportal Responsive version, in a center block.  Everything else seems to resize and stack, but not the latest images block, it just cuts it off and add a scrollbar.
I expect that would be mostly a CSS implementation - and CPMFETCH allows passing an 'options' array with classes to assign to various html entities:
Quote
    (Options) Entries that change the HTML tags output
        tableheadstyle
        tablestyle
        tableheadstyle
        rowstyle
        cellstyle
        linkstyle
        imagestyle

Adapted from examples in the doc:

//Example #1
$options = array( 'option_name' => 'option_value' , 'option_name' => 'option_value' );
$objCpm->viewRandomMediaFrom("",1,1,$options);

//Example #3 Real world example
$options = array("tablestyle" => "cssfortables" );
$objCpm->viewRandomMediaFrom("",1,1,$options);


Link to a copy of the CPMFETCH doc I have loaded on my site:
http://greggallery.gmcdesign.com/cpmfetch/docs/basic
Link to 'options' array section:
http://greggallery.gmcdesign.com/cpmfetch/docs/basic/cpmfetch/tutorial_explainations.optionsarray.pkg.html
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

Solare

Hi all.  Please, can someone help me for this?

I have a header file in root with this code,pointed by several file .php in different folders that include header.php, but path doesn't work with: ./cpmfetch or /cpmfetch or absolute path http://.....
It works only with rigt path ../ or ../../ ecpt. according to the folder in which it is located
Thanks!

<?php
  include_once "../cpmfetch/cpmfetch.php";
  $objCpm = new cpm ("../cpmfetch/cpmfetch_config.php");
  /* $options = array("subtitle" => "File name : {{pFilename}}"); */
  $objCpm->cpm_viewLastAddedMedia(1, 5, $options);
  $objCpm->cpm_viewRandomMediaFrom("cat= ",1, 5, $options);
  $objCpm->cpm_close();
 
?>

Solare

I apologize for the trouble...
It works, With complete path /var/www/vhosts/....

Another question please:
how to insert the contents of an entire album, respecting the same order of the photos in this album as in coppermine?
I only found the commands for LastAddedMedia and RandomMediaFrom

Thanks!

gmc

Quote from: Solare on March 03, 2018, 06:05:26 PM
I apologize for the trouble...
It works, With complete path /var/www/vhosts/....

Another question please:
how to insert the contents of an entire album, respecting the same order of the photos in this album as in coppermine?
I only found the commands for LastAddedMedia and RandomMediaFrom

Thanks!
Don't believe this is directly supported - the intent being to show a few pics - and link to the gallery if they want to see more/all...

CPMFetch doesn't have direct access to CPG's config - however at install time it does capture much of CPG's config into $config_cpgSettings... The default sort order is in $config_cpgSettings['default_sort_order'].  There are 8 possible values with 'na' (Name Ascending) being the CPG default  (see help for that item in CPG's CONFIG page for the definitions...)
It would seem to be possible to add something like 'viewAlbumMediaFrom' to CPMFetch that would be passed an album in the normal manner and fetch all pictures from that album in the CPG defined sort order... Of course not knowing how many pics there will be returned might make formatting interesting... I guess instead of passing 'rows and columns' total - would have to interpret as how many wide - and add rows as needed...

Don't have a lot of time to look at it - but does that sound like what you are looking for? 
What version of CPMFetch are you using?
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

Solare

First of all, thank you for your answer.
I'm using CPMFetch 2.0.0

Yes, should be what I'm looking for!

I'm testing CPMFetch in this page:
http://www.rotabili.ferrovie.it/schede/ - main page with random thumbnails from Coppermine
http://www.rotabili.ferrovie.it/schede/fs/locoele/fs-e402006-045.php - one of the technical sheets. After the table, all the pictures (random) about this locomotive from mine Coppermine album. I would be happy to have the photos of the locomotives in numerical order (E.402.010, E.402.011, E.402.017, ecc.)!

$objCpm->cpm_viewRandomMediaFrom("album= 323",999, 3, $options);
Code setted on 999 to take all the photos from album 323.

Thanks!

gmc

Quote from: Solare on March 04, 2018, 03:45:40 PM
First of all, thank you for your answer.
I'm using CPMFetch 2.0.0

Yes, should be what I'm looking for!

I'm testing CPMFetch in this page:
http://www.rotabili.ferrovie.it/schede/ - main page with random thumbnails from Coppermine
http://www.rotabili.ferrovie.it/schede/fs/locoele/fs-e402006-045.php - one of the technical sheets. After the table, all the pictures (random) about this locomotive from mine Coppermine album. I would be happy to have the photos of the locomotives in numerical order (E.402.010, E.402.011, E.402.017, ecc.)!

$objCpm->cpm_viewRandomMediaFrom("album= 323",999, 3, $options);
Code setted on 999 to take all the photos from album 323.

Thanks!

I have to set up a testbed for 2.0.0... (I use developers release 2.1.1) but if you are willing to try 'untested' (beyond syntax checking) code... I think this will work for you.
Need to update two members in cpmfetch folder

in cpmfetch.php - insert the following at the bottom (just above "}  //END OF CLASS")

/**
* GMC Addition:
* http://forum.coppermine-gallery.net/index.php/topic,65412.msg384710.html#msg384710
*
* Displays sorted images from specific album or category
*
* This will generate a table and populate it with sorted media from the combination of
* categories and albums specified and style it based on entries in the style hash.
* The number of photos returned matches the number of rows multiplied by the number of columns.
* Supports the setReturnType option.
*
* @param int $rows The number of rows desired in the output
* @param int $columns The number of columns desired in the output
* @param int $sources The sources you want to draw from ("cat=1,4,5:album=6,7,8")
* @param array $options Optional, Configuration options
* @tutorial explainations.optionsarray.pkg
* @tutorial explainations.sourcetag.pkg
*
* @todo allow for media to be specified / filtered - jpg, mp3, etc
*/
function cpm_viewMediaFrom($source,$rows, $columns, $options="") {
    $this->loadOptions($options);
    $resultset = $this->getImageFrom ($source, $rows*$columns);
    $this->addDescriptionsToResultSet($resultset);

    $retval = "";
    switch ($this->returntype) {
        case ('resultset'):
            $retval = $resultset;
            break;
        case ('html'):
            $retval = $this->createTable($resultset,$rows,$columns);
            break;
        case ('print'):
        default:
            print $this->createTable($resultset,$rows,$columns);
    }

    $this->clearOptions();
    return ($retval);
}


In cpmfetch_dao.php - insert the following at the bottom (just above "}  //END OF CLASS")

/**
* GMC Addition:
* http://forum.coppermine-gallery.net/index.php/topic,65412.msg384710.html#msg384710
*
* Returns a 'sorted' image from a category in cpm
* Sort order from CPG config at time of CPMFETCH install
* Available options:
* ("ta") - Title ascending
* ("td") - Title descending
* ("na") - Name ascending
* ("nd") - Name descending
* ("da") - Date ascending
* ("dd") - Date descending
* ("pa") - Position ascending
* ("pd") - Position descending
*
* @access private
*/
function getImageFrom ($source, $count) {
    global $config_cpgSettings;
    $resultset = array();

    if (is_numeric($count)) {

    $sourceSql = $this->makeSourceSql($source);

    switch($config_cpgSettings['default_sort_order']) {
        case 'ta':
          $orderby = "title";
        break;
        case 'td':
          $orderby = "title DESC";
        break;
        case 'na':
          $orderby = "filename";
        break;
        case 'nd':
          $orderby = "filename DESC";
        break;
        case 'da':
          $orderby = "ctime";
        break;
        case 'dd':
          $orderby = "ctime DESC";
        break;
        case 'pa':
          $orderby = "position";
        break;
        case 'pd':
          $orderby = "position DESC";
        break;
        default:
          $orderby = "filename";
        break;
       }
   
    if ($sourceSql != "") $sourceSql = " AND " . $sourceSql;

        $sqlcode = "SELECT {$this->sqlPostSelect} " . $this->sqlSelect . " FROM "
            . $this->sqlTableSelect
            . " WHERE 1 "
            . $this->sqlUserDataLink
            . " AND p.approved='YES' "
            . $this->filetypefilter . " "
            . $this->privacyfilter . $sourceSql
            . " ORDER BY $orderby) LIMIT $count";

        $resultset = $this->dbExecuteSql($sqlcode);
        $this->addPathInfo($resultset);

    } //end if
    elseif ($this->cfg['cfDebugMode'] == 'true'){
        debugPrint("Non numeric count submitted");
    }

    return($resultset);

} //end function


To use - change your $objCpm line to: (removes 'Random' from function name)

$objCpm->cpm_viewMediaFrom("album= 323",999, 3, $options);


In theory - this will produce a sorted view of up to 2,997 pictures (999*3) - from whatever category or album you ask for using standard cpmfetch parms (album= or cat= or again in theory both...)
The sort order is determined by your CPG default sort order variable that was copied into cpmfetch at install time - and can be updated/overridden in cpmfetch_config.php.  the default if it can't find config value is filename ascending.

I expect the same change can be made to CPG 2.0.1 (supports CPG 1.6 and PHP 7) - as I didn't make any changes in areas that would be affected.

I'll try to get my sandbox setup this week - but didn't want you to wait if I had something working. :)
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

Solare

Greg,
first of all thanks for the interest!
I entered the codes as indicated and I removed 'Random' from function name, but unfortunately it doesn't work and a white page appears :-(
I have to customize some lines in your code perhaps?

For your information:
Runs on: Tested on coppermine 1.3.2,
* HTML: Generates XHTML (as far as I can tell)
* PHP: Tested on version 4
* RELEASE VERSION 2.0.0
*
* @version $Revision: 1.12 $
* @package cpmfetch


cpmfetch.php (last lines original file and your new code):
/**
*
* @access private
*/
function clearOptions( ) {
$this->optionHash = array();
$this->styleHash = array();
}





/**
* GMC Addition:
* http://forum.coppermine-gallery.net/index.php/topic,65412.msg384710.html#msg384710
*
* Displays sorted images from specific album or category
*
* This will generate a table and populate it with sorted media from the combination of
* categories and albums specified and style it based on entries in the style hash.
* The number of photos returned matches the number of rows multiplied by the number of columns.
* Supports the setReturnType option.
*
* @param int $rows The number of rows desired in the output
* @param int $columns The number of columns desired in the output
* @param int $sources The sources you want to draw from ("cat=1,4,5:album=6,7,8")
* @param array $options Optional, Configuration options
* @tutorial explainations.optionsarray.pkg
* @tutorial explainations.sourcetag.pkg
*
* @todo allow for media to be specified / filtered - jpg, mp3, etc
*/
function cpm_viewMediaFrom($source,$rows, $columns, $options="") {
    $this->loadOptions($options);
    $resultset = $this->getImageFrom ($source, $rows*$columns);
    $this->addDescriptionsToResultSet($resultset);

    $retval = "";
    switch ($this->returntype) {
        case ('resultset'):
            $retval = $resultset;
            break;
        case ('html'):
            $retval = $this->createTable($resultset,$rows,$columns);
            break;
        case ('print'):
        default:
            print $this->createTable($resultset,$rows,$columns);
    }

    $this->clearOptions();
    return ($retval);
}
} // end class

?>


And cpmfetch_dao.php  (last lines original file and your new code):
/**
*
* @access private
*/
function getRandomSeed() {
return microtime()*1000000;
}

/**
* GMC Addition:
* http://forum.coppermine-gallery.net/index.php/topic,65412.msg384710.html#msg384710
*
* Returns a 'sorted' image from a category in cpm
* Sort order from CPG config at time of CPMFETCH install
* Available options:
* ("ta") - Title ascending
* ("td") - Title descending
* ("na") - Name ascending
* ("nd") - Name descending
* ("da") - Date ascending
* ("dd") - Date descending
* ("pa") - Position ascending
* ("pd") - Position descending
*
* @access private
*/
function getImageFrom ($source, $count) {
    global $config_cpgSettings;
    $resultset = array();

    if (is_numeric($count)) {

    $sourceSql = $this->makeSourceSql($source);

    switch($config_cpgSettings['default_sort_order']) {
        case 'ta':
          $orderby = "title";
        break;
        case 'td':
          $orderby = "title DESC";
        break;
        case 'na':
          $orderby = "filename";
        break;
        case 'nd':
          $orderby = "filename DESC";
        break;
        case 'da':
          $orderby = "ctime";
        break;
        case 'dd':
          $orderby = "ctime DESC";
        break;
        case 'pa':
          $orderby = "position";
        break;
        case 'pd':
          $orderby = "position DESC";
        break;
        default:
          $orderby = "filename";
        break;
       }
   
    if ($sourceSql != "") $sourceSql = " AND " . $sourceSql;

        $sqlcode = "SELECT {$this->sqlPostSelect} " . $this->sqlSelect . " FROM "
            . $this->sqlTableSelect
            . " WHERE 1 "
            . $this->sqlUserDataLink
            . " AND p.approved='YES' "
            . $this->filetypefilter . " "
            . $this->privacyfilter . $sourceSql
            . " ORDER BY $orderby) LIMIT $count";

        $resultset = $this->dbExecuteSql($sqlcode);
        $this->addPathInfo($resultset);

    } //end if
    elseif ($this->cfg['cfDebugMode'] == 'true'){
        debugPrint("Non numeric count submitted");
    }

    return($resultset);

} //end function
}  //END OF CLASS

?>


David

gmc

David,

I'll try to get my sandbox up and running with 2.0.0 this weekend and see what I can find...
Can't really suggest a change just from that result.

Greg
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

Solare

Ok Greg, no problem.

Thanks!

MG

I tried to find information on integration of CPMfetch together with vBulletin / vBadvanced.
The modification works with vBulletin 4.1.11 and vBadvanced CMPS v4.2.0.

I'm not a programmer and I do not know about coding, but I managed to integrate CPMfetch for vBadvanced.

First of all, you need to create a new .php file.
I used Rapid php for this.
You can name the .php file as you like it. I called to "om_resources_thumbnail_gallery.php"
- ./gallery/ name is your name folder where you have CPMfetch mod.

- in line   $objCpm->cpm_viewLastAddedMedia(1,1); set how many images you want to show.

<?php
    
include "./gallery/cpmfetch/cpmfetch.php";
    
$objCpm = new cpm("./gallery/cpmfetch/cpmfetch_config.php");
    
$objCpm->cpm_viewLastAddedMedia(1,1);
    
$objCpm->cpm_close();
?>


Next step is upload your new file .php ("om_resources_thumbnail_gallery.php") to your folder on serwer where you have Modules from vBadvanced.
Next you go to vBulletin Admin Panel > vBa CMPS > Add Module > (Module Type set to ) [PHP File Module].

In next window you need to add :
- Module Title: whatever you called
- set module to Active : YES
- File to Include: pick up your .php file from the list > (om_resources_thumbnail_gallery_1) or whatever you called this file.
- Identifier: PHP file modules require a unique identifier to help identify the module and its settings. Please note that this cannot be changed later and the identifier used for each PHP module must be unique.
- Clean File Output: set to YES ( If you check this option on "NO" your thumbnail preview from galleri will be displayed at the very top of the page instead of in the module with vBadvanced. So I suggest you check this option on "YES")

- Use Module Wrapper Template : set to YES
- Usergroup Permissions: You can select groups for which images from the gallery will be displayed in the vBadvanced module.

Next step is Save and you go to the next page from vBa Admin Panel: 
- Your module has been successfully saved. Click "Go Back" to add another module, or click "Continue" to activate this module on your CMPS pages. So click "Continue"
- Pick where you want to show this modules ( whitch page and whitch column )
Thats all.

I hope that my English is understandable (English is not too strong for me, sorry) and I hope that someone will find this information useful.
In the attachments I added a preview from "vBA Admin Panel"

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
One thing I don't now how to solved:

Everything works fine but the thumbnail in module shows from left side (check image from attachments) 
I would like to show images to center not from lef side.
BTW is there a chance to show some info below thumbnails something like title this image and autor?


Forum Vbulletin 4.1.11  / Portal vBadvanced CMPS v4.2.0, bridged with CPG 1.5.46, cpmfetch 2.0.0