Advanced search  

News:

cpg1.5.46 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter recently discovered vulnerabilities. It is important that all users who run version cpg1.5.44 or older update to this latest version as soon as possible.
[more]

Pages: 1 2 3 4 5 [6]   Go Down

Author Topic: CPMfetch for 1.5.6  (Read 114243 times)

0 Members and 1 Guest are viewing this topic.

ron4mac

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Posts: 925
Re: CPMfetch for 1.5.6
« Reply #100 on: May 31, 2017, 01:13:03 pm »

Looking into it .......
Logged

ron4mac

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Posts: 925
Re: CPMfetch for 1.5.6
« Reply #101 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.
Logged

gmc

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 741
    • GMC Design Photo Gallery
Re: CPMfetch for 1.5.6
« Reply #102 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??

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

ron4mac

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Posts: 925
Re: CPMfetch for 1.5.6
« Reply #103 on: May 31, 2017, 06:06:22 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).
Logged

lurkalot

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 835
  • +Tinyportal Support team.
Re: CPMfetch for 1.5.6
« Reply #104 on: May 31, 2017, 06:51:05 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.
Logged
Running SMF 2.0.13  / Tinyportal 1.2, bridged with Coppermine 1.5.34, plus cpmfetch 2.0.0

Phill Luckhurst

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4564
    • Windsurf.me
Re: CPMfetch for 1.5.6
« Reply #105 on: May 31, 2017, 07:30:55 pm »

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

ron4mac

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Posts: 925
Re: CPMfetch for 1.5.6
« Reply #106 on: June 02, 2017, 01:50:32 am »

In my opinion 2.0.0 should have been the one updated

Find version 2.0.1 in original post.
( removed 2.2 )
Logged

lurkalot

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 835
  • +Tinyportal Support team.
Re: Re: CPMfetch for 1.5.6
« Reply #107 on: June 02, 2017, 09:56:08 am »

Find version 2.0.1 in original post.
( removed 2.2 )

Excellent, works nicely, no errors so far.  thank you.   
Logged
Running SMF 2.0.13  / Tinyportal 1.2, bridged with Coppermine 1.5.34, plus cpmfetch 2.0.0

gmc

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 741
    • GMC Design Photo Gallery
Re: CPMfetch for 1.5.6
« Reply #108 on: June 03, 2017, 11:40:57 pm »

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.
Logged
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

lurkalot

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 835
  • +Tinyportal Support team.
Re: CPMfetch for 1.5.6
« Reply #109 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.
Logged
Running SMF 2.0.13  / Tinyportal 1.2, bridged with Coppermine 1.5.34, plus cpmfetch 2.0.0

gmc

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 741
    • GMC Design Photo Gallery
Re: Re: CPMfetch for 1.5.6
« Reply #110 on: February 12, 2018, 08:38:50 pm »

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:
Code: [Select]
//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
Logged
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

Solare

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: CPMfetch for 1.5.6
« Reply #111 on: March 03, 2018, 01:52:07 pm »

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();
 
?>
Logged

Solare

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: CPMfetch for 1.5.6
« Reply #112 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!
Logged

gmc

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 741
    • GMC Design Photo Gallery
Re: CPMfetch for 1.5.6
« Reply #113 on: March 04, 2018, 02:25:13 am »

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?
Logged
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

Solare

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: CPMfetch for 1.5.6
« Reply #114 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.)!

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

Thanks!
Logged

gmc

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 741
    • GMC Design Photo Gallery
Re: CPMfetch for 1.5.6
« Reply #115 on: March 07, 2018, 12:29:45 am »

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.)!

Code: [Select]
$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")
Code: [Select]
/**
* 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")
Code: [Select]
/**
* 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)
Code: [Select]
$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. :)
Logged
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

Solare

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: CPMfetch for 1.5.6
« Reply #116 on: March 08, 2018, 06:51:32 pm »

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:
Code: [Select]
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):
Code: [Select]
/**
*
* @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):
Code: [Select]
/**
*
* @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
Logged

gmc

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 741
    • GMC Design Photo Gallery
Re: CPMfetch for 1.5.6
« Reply #117 on: March 09, 2018, 02:35:50 pm »

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
Logged
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

Solare

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: CPMfetch for 1.5.6
« Reply #118 on: March 12, 2018, 06:15:29 pm »

Ok Greg, no problem.

Thanks!
Logged
Pages: 1 2 3 4 5 [6]   Go Up
 

Page created in 0.027 seconds with 20 queries.