CpmFetch - (OLD/LOCKED) stats/thumbnails/randoms/etc from outside CPG CpmFetch - (OLD/LOCKED) stats/thumbnails/randoms/etc from outside CPG
 

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 - (OLD/LOCKED) stats/thumbnails/randoms/etc from outside CPG

Started by vuud, December 17, 2004, 10:19:07 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

vuud

THIS THREAD HAS BEEN LOCKED... PLEASE POST TO THE NEW THREAD

http://forum.coppermine-gallery.net/index.php?topic=19564.0

Note: Stable release attached here / dev versions available at the homepage.

http://cpmfetch.fistfullofcode.com - latest info, news, development versions, tips, etc

This is a PHP object that allows you to easily display random or latest images from your coppermine gallery on external php and html pages.  It is being actively supported and developed by me.  Its simple, but I am also trying to make it as feature rich as I can without achieving bloat.  You can draw images (random or otherwise) from the entire gallery, a specific category or a single album.


:D Notifications of new releases

I added a sign up to my site for email notifications of new updates to cpmfetch.

http://www.fistfullofcode.com/projects/copperminefetch/index.php

A little ways down the page there is a signup entry.


??? What is this all about

Basically It takes criteria and returns tables containing thumbnails based on a row col combination you specify.  You tell it what kind of random images you want, in how many columns by how many rows (1 x 1 being a single image).  It gets the images and gives you back HTML code that displays them all.

??? What about private albums?  This library will not display any images that are not viewable by the world or are not in an approved state.  If you request the number of images in the gallery, it will count the private images in the number it returns. 

??? Reporting Problems?  Make sure you have the newest version!  Message me on this board or contact me via my website www.fistfullofcode.com.  Do me a favor and:


  • Include what version of coppermine you are using
  • a link to your website and gallery
  • a link to an example of the problem (if possible)
  • how computer savvy you are (newbie, intermediate, damn good)
  • what kind of web server you are running on (if known)
  • Include the syntax of the command you are using.

Also, try adding this to the top of your php page.  It will cause more errors and warnings to be displayed.

<?php 
error_reporting(E_ALL);
ini_set('display_errors',1);  // 0 is off, 1 is on
?>


??? What if its close to what you need, but not quite?.  Contact me and let me know what you think it needs.  I won't quarentee anything, but if it sounds reasonable I will probably do it.

??? Can I control the HTML it generates?  Currently you can control the tables and images it gives back via css settings and passing the css class to the object.  Future plans include adding titles and such.  Examples of CSS control are on the website (some are pretty cool)

Aside from images, it can also returns other data such as (note: the album names are links)

Since Friday, December 10 2004 we've added about 355 images

Category nameAlbumNew count
Haley - The early years (1999-2002)2000 Haley - the second year17 new 
  1999 Haley - the first year  69 new 
  2001 Haley - the third year   30 new
Haley, Christi and meOur furry friends 18 new
  May 2003 - Beckett Trip15 new
  Misc - Just don't fit anywhere11 new
     

More examples and downloads are here:
http://www.fistfullofcode.com/projects/copperminefetch/

Among the functions so far are stuff like this...  Many more have been added, so see the web site

Functions that return images

  • cpm_viewLastAddedMedia ($rows, $columns, [array $options = ""])
  • cpm_viewLastAddedMediaFromAlbum ( $rows,  $columns,  $albumid, [array $options = ""])
  • cpm_viewLastAddedMediaFromCategory ( $rows,  $columns,  $catid, [array $options = ""])
  • cpm_viewLastAddedMediaFrom ( $rows,  $columns,  $source, [array $options = ""])
  • cpm_viewRandomMedia ( $rows,  $columns, [array $options = ""])
  • cpm_viewRandomMediaFromAlbum ( $rows,  $columns,  $albumid, [array $options = ""])
  • cpm_viewRandomMediaFromCategory ( $rows,  $columns,  $catid, [array $options = ""])
  • cpm_viewRandomMediaFrom ( $rows,  $columns,  $source, [array $options = ""])

Functions that return textual statistics

  • cpm_formatStats ($format)
  • cpm_listMediaCount ()
  • cpm_getMediaCount ()
  • cpm_listMediaCountForAlbum ($albumid)
  • cpm_getMediaCountForAlbum ($albumid)

Functions that return gallery level images and text

  • cpm_listMediaAddedOverLastDays ($numberOfDays, [ array $options=""])
  • cpm_viewLastCommentedImages($rows,$columns, [ array $options=""])
  • cpm_showCategoriesUpdatedOverLastDays($numberOfDays,$options="")
  • cpm_showAlbumsUpdatedOverLastDays($numberOfDays,$options="")

Functions that control this program and its behavior

  • cpm ($urltocpm)
  • cpm_init ( Depreciated old constructor )
  • cpm_close ()
  • cpm_setFilter($filter)
  • cpm_setReturnType($type)
  • cpm_unlockPrivate($bool)
  • cpm_OverridePathToCoppermine($newpath_)
  • cpm_OverrideUrlToCoppermine($newpath_)
  • cpm_setDebugMode($bool)


Brief explanation of some of the above parameters

$albumid - is always the numerical id of the album
$catid - is always the numerical if of the category
$source - this is a new way of specifying albums and categories at the same time
$rows,$columns - the combination determine how many total to show and in what orientaion
$columns - how many columns of images to show
$options - this is an array of options (covered below)
$format - text to display interspersed with placeholders for variables



Some features are:


  • Limiting what kinds of media to return (not music, etc)
  • Multimedia images returned for video, sound, etc (unless overridden with custom media)
  • Last added media by album and category
  • Access override into private albums
  • Option to link images to album or fullsize image
  • Option to link to intermediate image
  • Text reporting on how many added, how many comments, etc, since...
  • Improved documentation - Ongoing
  • Docs on how to use this for random avatars
  • Alt and title tag formatting
  • Clean html output

(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.fistfullofcode.com%2Fprojects%2Fcopperminefetch%2Fcss_example_2.jpg&hash=c7bdf3a9b3101197032bd73f705ee6d368a4d494)

Example of usage:

The HTML version of the library only allows for one image to be retrieved at a time via an img tag.  To do this you simply point the image tag at the php page supplied and away you go.

img src="/cfimageget.php?category=7"

(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.fistfullofcode.com%2Fphp-lib%2Fcpmfetch%2Fcfimageget.php%3Fcategory%3D7&hash=d36af8760990186cacf839d00f5ec5b5bc73d6c6)
The above image was served up from my gallery via an img tag .


The following code shows how you would get 3 random images in a column from album #7

<?php 
include "../php-lib/cpmfetch/coppermine.php";
$objCpm = new cpm('/photos');
$objCpm->cpm_viewRandomMediaFromAlbum(1,3,7); 
$objCpm->cpm_close(); 
?>



A more intricate example passing some CSS info for the table is


<?php 
$options 
= array(
"tableStyle" => "photoclip",
"rowStyle" => "photoclip",
"cellStyle" => "photoclip",
"linkStyle" => "photoclip",
"altTag" => "One of the last photos submitted",
"imageStyle" => "photoclip",
                
"imagesize" => "int") ;

$objCpm->cpm_viewLastAddedMedia(4,2,$options); 
?>



??? Boy I am impressed!  I want to send you things... money, gifts, girls, etc... how can I do this?  Well, tell you what... the Coppermine people have put probably at least 2000x more work into Coppermine.  Why not send something to them instead.  I tried finding a link on the site to send you too... couldn't - if you can't either, send a donation to the www.eff.org instead. 

??? Whats coming up in the near future for this?  There is a big list of things for the next release probably stable at the end of January 2005.  See the link off this post to the topic discussing it or see the website for the most comprehensive list
[
Any advice, comments, request for something new in it, etc... pass them on, please

http://cpmfetch.fistfullofcode.com

See the readme.html enclosed for information, etc - or available online in the docs section of the website.  Toward the bottom a list will show you what has been added to new development versions since the stable.

The version attached below is the latest stable version.  However, there are always development versions available at the web site shown above... those should always work, and sometimes have neat new features added.   I only post the latest stable version here and remove old ones.  If you need an older version, see the web site.


The downloads have been moved to the new thread.  I am removing them from here to save server space and it is also one less place I will have to update

http://forum.coppermine-gallery.net/index.php?topic=19564.msg89802#msg89802


Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

Tarique Sani

SANIsoft PHP applications for E Biz

vuud

Regarding the admin / private settings.  It does and does not.  I think in logical places, although I could probably be convinced otherwise.

Here is how it breaksdown.

No image will ever be counted or shown if it has not been approved

Functions that return numbers (total images in the gallery) will count private galleries images

Functions that display images will never display a gallery marked as private.  I suppose there should be an allowance on bypassing this rule, but for now it will not show anything that does not have a album.visibility = 0.

As for the admin, do you mean unapproved?  I was unsure.  If approved = NO, then things are not counted or displayed.

Hope that helps
Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

vuud

http://www.fistfullofcode.com/projects/copperminefetch

CoppermineFetch allows you to easily display thumbnails from a Coppermine photo gallery. Out of all the web based photo galleries, I would recommend Coppermine over the rest of them. Installation is a breeze, its feature rich and works with large libraries.

CoppermineFetch allows for the easy insertion of single PHP tags into your web pages that display thumbnails from your Coppermine installation based on criteria you specify. Among the different options at your disposal you can:

    * Display the number of images in the gallery or in a single album
    * Display the number of images added since X days ago
    * Ask for any amount of images in a single call
    * Display random images from the gallery
    * Display random images from a category
    * Display random images from a specific album
    * Display the last number added for the gallery, category or album
    * Display a list of images added over past # days

CoppermineFetch creates tables to display your thumbnails, allowing for you to not worry about the handling the return data. You can also extend the main object and add your own formatting, or submit css styles and have CoppermineFetch apply them. All HTML returned is XHTML 1.0 Transitional compliant.

What about my private albums? CoppermineFetch will not display any thumbnails unless they are set to be viewable by the public. The function that returns the total number of images in the gallery will count them however. Pictures in an unapproved state are never counted or displayed.

CoppermineFetch connects to your database at the last possible moment, and releases the connection as late as possible. Since the database connections are comparatively slow, this allows the most use for the least wait.
Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

n3n

Tnx alot for this awesome mod, its just what i was searching for, i really like it that i can choose which output it gives.
i just have one problem, i just get a white page. I don't have to change any settings right ? (im a little tired)
Any tips on how to solve this problem ?

tnx

vuud


Well, I am still working on some documentation, and as I think about it - I may have just removed some really important things from my web site that you need to know.

First) At the top of the page that you want to display you need to initialize the library by something like this:

<?php 
include 
"./config.inc.php";
include "./coppermine.php";
$objCpm = new cpm($mysql_dbname$mysql_host$mysql_username$mysql_password$cpm_mysql_tableprefix$urltocpm);
?>


In this example, the first include is just a PHP file that declares the variables,  Instead of doing that you can just put them in, but I find it easier to put them in a file (as I use this around my site alot).  The includes also have to be a correct path to the program (sorry if this is obvious to you, but its hard to determine a skill level from here). 

After that, anywhere in the php you can insert any call you want without having to do that again.  For example.

<?php $objCpm->cpm_viewRandomMediaFromCategory(1,1,7); ?>

At the end of the page, you should call the close function to close out database connections.

<?php $objCpm->cpm_close(); ?>

Mind you, if you only want to do one call on your page you can stick it all together like so:

<?php 
include "./config.inc.php";
include 
"./coppermine.php";
$objCpm = new cpm($mysql_dbname$mysql_host$mysql_username$mysql_password$cpm_mysql_tableprefix$urltocpm);
$objCpm->cpm_viewRandomMediaFromCategory(1,1,7);
$objCpm->cpm_close();
?>


But, if you plan on doing more than one call on a page, its best to do it the second way (that way only one database connection is created).

If that does not help, let me know...  Its pretty new, so if you have any other need that it does not fit - let me know and I can probably add it in - if it fits with my general scheme of things!


BTW: If you are unsure of your database name and such, look on your website in your coppermine directory under includes/config.inc.php - that contains all the information you need.  You could probably even just include this file and alter the variables show above.

The $urltocpm is the path a web browser takes to get to your coppermine directory,... for example, mine is http://www.fistfullofcode.com/photos - so my $urltocpm variable gets set to '/photos'

Hope this helps!








Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

vuud

...also...

You can also use your existing coppermine config file to provide most of the information. 


<?php
include "../photos/includes/config.inc.php";
include 
"./coppermine.php";
$objCpm = new cpm($CONFIG['dbname'], $CONFIG['dbserver'], $CONFIG['dbuser'],$CONFIG['dbpass'], $CONFIG['TABLE_PREFIX'], '/photos');
?>



*note* the '/photos' at the end should be whatever directory your coppermine is installed into.

For most people this would probably be the best way to go about things.

Happy holidays  ;D

Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

n3n

Tnx for the reply.
For now i just wanna have one code on my page to test it and stuff.
Still i dont get any result :( very weird.
my code:

<?php
include "/grafflix/config.inc.php";
include 
"/grafflix/copperminefetch/coppermine.php";
$objCpm = new cpm($mysql_dbname$mysql_host$mysql_username$mysql_password$cpm_mysql_tableprefix$urltocpm);
$objCpm->cpm_viewRandomMediaFromCategory(1,1,7);
$objCpm->cpm_close();
?>



You dont happen to see any errors right ? the test.php is in the root dir, the coppermine in the /grafflix dir

tnx

vuud

The code you have there looks good to me and could work, but here are some things that could be doing it.

1.  The paths you have set for your includes... they point at the the root and then graffix.  That could tell the php script to head off to the top of the drive and look for it.  Try adding a leading period to the path.  That tells it to start in the current directory.

2.  You do have this code in a .php page right?  I am working on something that will work from HTML pages, but it has less functionality and is just done prototyping

3.  Last but not least, do you have a category 7?  The code says 1 image from category 7 and unless you have one of those - you will get nothing back (since it did not find any for that).

I am thinking it is #3...  You can find out what category numbers you have by going into your coppermine programs main page and looking at the links onto the different categories.  The URL should have category=(a number).   You can always try the viewRandomMedia(1,1) to make sure thats not the problem also.

Hope that helps!  Let me know which one it was




Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

n3n

Tnx for the reply again.
I tried everything you said, you we're right that i didnt have a categorie 7, changed the 7 to a 9 (that DOES exist), but nothing happened.
I have the code in a php file, so that shouldnt be a problem.
I didnt really understand what you meant with "adding a leading period to the path" (although my english is ok, it isnt my native language)

Also i would like to know what the two 1's mean in front of the 7 (or the 9 in my case), i suppose that one "1" stands for a picture, but wasnt sure about the other "1" (hope this makes any sense :P)

tnx for the help

vuud


First the easy question:

What does the 1,1 mean.  It determines how many photos you get back - it means (rows, columns).  So if you do 2,2 - you get 4 back.  If you do 1,5 you get one row of five photos.

The leading periods are probably not it, but you can try adding them to your includes before the first slash

include "./grafflix/config.inc.php";
include "./grafflix/copperminefetch/coppermine.php";

Try the viewRandomMedia(1,1) call.

And what version of coppermine are you running?

We can do this!
Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

n3n

aah still nothing :(

tried the ./ thing, and also tried the function. This is quite weird.
Im running version 1.3.2

vuud


Do you get back anything...  broken images?  Can you send me a link to the page that is displaying the nothing?
Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

n3n

yes the page is at: http://xxx/flix.php, let me know when you got it, then i'll remove it here.

tnx


vuud


Hey, I got the url, so you can remove it.

Strange that it does not show anything at all.  Can you do me a favor and post the entirety of your page here (or email it to me  bill (at) Explosivo.com

Also if you can do one more thing and try the

cpm_listMediaCount ( );

call.  It sounds like nothing in your database is matching the criteria...  Strange...

One other thing... are you setting the $urltocpm variable?  That should be the directory coppermine is installed in.

In your case it would be either $urltocpm="/grafflix" or just replace it in the command with '/grafflix'


Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

n3n

tried all of them, just found out that i dont seem to have a config.inc.php in /grafflix, i only have a config.php there, i do have a config.inc.php in grafflix/include... changed the code to:

<?php
include "./grafflix/include/config.inc.php";
include "./grafflix/copperminefetch/coppermine.php";
$objCpm = new cpm($mysql_dbname, $mysql_host, $mysql_username, $mysql_password, $cpm_mysql_tableprefix, 'grafflix');
$objCpm->cpm_listMediaCount ( );
$objCpm->cpm_close();
?>

but still nothing :(

oh yea, thats my entire page, so dont think it will be any use to mail it :P apreciate your help btw :)

vuud

I think we have it this time... you have a combination of all the different ways to do it - probably due to my documentation in progress.  Change your code to this:

I am almost sure that will get you there.


<?php
include "./grafflix/include/config.inc.php";
include 
"./grafflix/copperminefetch/coppermine.php";
$objCpm = new cpm($CONFIG['dbname'], $CONFIG['dbserver'], $CONFIG['dbuser'],$CONFIG['dbpass'], $CONFIG['TABLE_PREFIX'],'/grafflix');
$objCpm->cpm_listMediaCount ( );
$objCpm->cpm_close();
?>



Let me know!


Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

n3n

sorry to dissapoint you.. but still nothing :(

im starting to think that my server doesnt like it or something..

vuud

Do mea favor and add in

print "Test";

somewhere inside the <?php       ?> tags.

You should be getting an error or something at least! 

Strange!
Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

n3n