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

News:

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

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.

blackhat

I'm a newbie t o php but I've managed to get it working, but I wanted to know if someone could help me pul all this into a variable that I can include in my template.

thanks :)

vuud


I can try, but I am not quite sure what you mean?

vuud


Quote from: blackhat on December 23, 2004, 12:53:58 PM
I'm a newbie t o php but I've managed to get it working, but I wanted to know if someone could help me pul all this into a variable that I can include in my template.

thanks :)
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

Titooy

Great mod !

(Could you numerate your packages in order to know if we have the last version?)

cxprod

Quote from: vuud on December 22, 2004, 08:45:09 AM
Is there a site I can snag a few wmv files from to test this out.  Preferrably one with custom thumbnails so I can make sure it works.

I was poking at it some today and found the default media thumbs.  So you are saying you can make your own thumb specifially for one media file (say a frame from it) and it will serve that up if you have it... default otherwise.

That should not be hard....
( I probably just cursed myself saying that)

Actually all my sites are in a pass protected area & adult in subject matter...  not everyones cup of tea...

You could probably find a few wmv files in your my videos location as samples for windows media player
For a custom thumb all you need to do is put a thumb_moviefilename.jpg in the same folder the videos are
located in the album area of the gallery... 



vuud


Thanks!   Since there has actually been a response to this mod, I am rewriting part of it based on new needs.  By the end of this month, version 1 will be released.   I will start a formal numbering system with the release of that one (as 1.0)

The basis will be the same, but somethings will be easier, like installation.

thanks again

Quote from: Titooy on December 23, 2004, 06:14:06 PM
Great mod !

(Could you numerate your packages in order to know if we have the last version?)
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

Quote from: cxprod on December 24, 2004, 12:02:16 AM
Actually all my sites are in a pass protected area & adult in subject matter...  not everyones cup of tea...

You could probably find a few wmv files in your my videos location as samples for windows media player
For a custom thumb all you need to do is put a thumb_moviefilename.jpg in the same folder the videos are
located in the album area of the gallery... 

;D No problem.  I was able to achieve the same functionality with some mp3's and custom images.

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

 ;D Just in time for xmas

Version 0.6 - http://www.fistfullofcode.com/projects/copperminefetch/copperminefetch-dev.tar.gz

This is not quite everything I want to get done this year, but its enough where you can start playing with it.  In summary:

<ul>
<li>Changed stylehash is now optionhash</li>
<li>Added imagesize=[thumb,int,large] as optionhash option</li>
<li>Improved cfimageget.php program</li>
<li>Initialize by pointing to the cpm directory</li>
<li>Multimedia images returned for video, sound, etc</li>
<li>Last added media by album and category</li>
<li>Text reporting on how many added, how many comments, etc</li>
</ul>

Some really really important notes:

The biggest change, and the one that will cause you the most grief is the way the coppermine object is constructed.  The old way involved this:

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

No more!  The new way has been reduced to this:

   include "./coppermine.php";
   $objCpm = new cpm('/photos');

Now, the parameter there is the url path to the coppermine directory.  NOT THE WHOLE URL... in my case my coppermine gallery is at http://www.fistfullofcode.com/photos.  So I just have to put /photos.  it will figure everything else out.


If you still want to do the old way (for some reason), you can do it with

$objCpm = new cpm( );
$objCpm->init( ... all the old parameters ... )

But why on earth would you want to? 

Okay, we have something for everyone here.

;D The Stylehash is now an option hash and takes a size argument. 
imagesize = thumb, int, large.  More options will be added to this in the future and it will become the main way to customize your returned images

I also reworked the code so the parameters you pass in are case insensitive.

;D Somewhat graceful handling of multimedia files.   CoppermineFetch will, when getting something other than a JPG check first for a custom thumbnail for the file, and if that does not work, it will return the default image for that file type.  This is less than perfect as if you request intermediate sized files, you still get a little thumbnail.  More work will be done on this in the future, but for now you at least get something back.  IT DOES NOT at this time take into account themed icons.  That could be coming up, if you use them, let me know and I may bump it up my list.  That would involve extra DB calls to get configuration which I refuse to do - unless absolutely need to.  I have a work around in mind, but thats coming up later.

;D Last added media by album or category.  By popular demand:

cpm_viewLastAddedMediaFromCategory($rows, $columns, $catid, $options="")
cpm_viewLastAddedMediaFromAlbum($rows, $columns, $albumid, $options="")


;D Nifty stats ouputing.  For the guy who wanted it to say 72 files in 3 albums, etc.

cpm_formatStats($format);


Format would be a string interspersed with whatever text you want and placeholders.  The following placeholders are valid at this time:

%f - file count
%a - album count
%c - category count
%v - view count
%n - comment count (note count)
%% - Escapes a percent sign. (I dont know either, it just seemed like a good idea)

This example:
$objCpm->cpm_formatStats("Here is a percent sign %% There are %f files in %c categories containing %a albums, having served %v views and getting %n comments");

outputs:

Here is a percent sign % There are 366 files in 8 categories containing 27 albums, having served 243 views and getting 0 comments

Still to do for the 1.0 release.
* Access override into private albums<br />
* Subtitles under images generated<br />
* Option to link images to album or specific image<br />
* Improved documentation<br />
* Docs on how to use this for random avatars<br />
* Added private_override as optionhash options<br />
* Limiting what kinds of media to return (not music, etc)<br />

For those of you not familiar with development releases... this means it may work really well for you, or somethings may be broken.  What tests here on my box, may not run on yours for some unknown reason.  So PLEASE send me feedback if it works fine for you, if something is strange, etc...  If I don't know about it, I cant fix it.

I also promise some usable docs!


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

Tranz

Quote from: vuud on December 24, 2004, 09:45:43 AM
* Docs on how to use this for random avatars<br />
That would be great. I actually tried to use coppermine fetch for a random signature but it didn't work.

I figured out a way using another script and .htaccess, but it is not very elegant and I'm stuck using specific albums.

vuud

Quote from: TranzNDance on December 24, 2004, 09:53:00 AM
Quote from: vuud on December 24, 2004, 09:45:43 AM
* Docs on how to use this for random avatars<br />
That would be great. I actually tried to use coppermine fetch for a random signature but it didn't work.

I figured out a way using another script and .htaccess, but it is not very elegant and I'm stuck to specific albums.

Heh, its incredibly simple...  You need to get the cfimageget.php working.  Should be simple, there are only like two things in the top of the file to configure.

After that, whenever you have the option to specifiy a url for an avatar... just enter

http://www.yourwebsite.com/path/to/cfimageget.php

Thats it, a random thumbnail all the time

You can also add on ?category=3   or ?album=3 (whatever numbers you want)

I use it like that here

Me sleep now

Happy holidays



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

Joachim Müller

attaching your files to my posting (for future reference in case the original files go down), both the original and a zipped version.

Joachim

[edit]
removed attachments, use the attachments in the first posting on the thread for the most recent versions of the files.
[/edit]

vuud


Thanks much, is that something I should do with current versions?  Probably not a bad idea :)

Thanks much!
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

Joachim Müller

yes, please attach your mods to your postings whenever possible. You might want to consider naming the files with reference to the version number. Using the naming scheme we use for our own files your file would be named like this: cpg1.3.2_mod_copperminefetch0.6.tar.gz, but of course you're free to come up with a naming scheme of your own, e.g. copperminefetch-0_6.tar.gz

Joachim

vuud

Quote from: GauGau on December 26, 2004, 10:39:15 AM
yes, please attach your mods to your postings whenever possible. You might want to consider naming the files with reference to the version number. Using the naming scheme we use for our own files your file would be named like this: cpg1.3.2_mod_copperminefetch0.6.tar.gz, but of course you're free to come up with a naming scheme of your own, e.g. copperminefetch-0_6.tar.gz

Joachim

Well, Mom alwatys told me to fit in and conform so I have no problem doing it that way :)

I will probably go with the later, since I am tied very very little to coppermine, the version scheme is not as applicable.  And most of what I tie to would not change between releases probably.

I'll keep the most up to day on the intial post using your second way... 

Thanks for coppermine!






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

#93
Okay, I have produced a test version to make sure that it works before I give it the big version 1.0.

;D Much going on if you did not get the last development release.  Much has been added.

:-\\ I am sorry to say that some of the plans for this release have been put of.  This basically means the "subtitles" and also the multiple category / album selection.  On both of these counts I have run into some issues that I need to think over more.

I am attaching both a tar.gz and a .zip file.  There is an updated Readme.html in the docs directory.

Changes and updates include:

  • Simplified startup of object
  • Access into private albums now possible
  • Control over if the thumbnail is a link
  • Control over target of link
  • Control over what it links to (album or large photo)
  • Displays images for non jpg formats
  • Filter out unwanted media types at will
  • More getlastadded functions
  • Formatted statistics now possible
  • Easier cfimageget.php configuration

Well, if you try it - let me know if it works - comments and suggestions.  If some people can try it out and it works, I can roll out 1.0 and start on some new features.

Happy holidays
;D
Updated:  31-Dec-2004 - The 0.7 release has been superceeded.  The first post in this thread will always have the latest Dev and dist versions (although 0.8 is the best right now)

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


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

kaptainkory

A couple of suggestions...  (Good work, by the way.)

I've been using cpm_viewLastAddedMedia and cpm_viewLastAddedMediaFromAlbum.

1) imagelink should have a setting to link to the display page of the image (ex: http://somesite/galleries/displayimage.php?pos=-803)
2) imagelink should have a setting to call the javascript function MM_openBrWindow (this is what Coppermine does to display a large image)
3) more options should be available for the alt attribute.  I specifically would like to show the date of the image in the alt tag, but there are probably other things that would be useful to show as well.
4) add a title attribute that is identical to the alt attribute.  (Mozilla browsers don't show alt attributes on mouseover, but they do show title)

BUG? -- I'm getting a double slash between the directory and the file:  http://somesite/galleries/albums/test//testpic.jpg

BUG? -- It seems some "box" characters got added to the end of some of the files of version 0.7, probably artifacts of zipping the files.  They don't hurt too much except they do get printed on the html page when coppermine.php is included.  I'm using windows...

Thanks,
Kory

vuud

Quote from: kaptainkory on December 30, 2004, 11:42:40 PM
A couple of suggestions...  (Good work, by the way.)

I've been using cpm_viewLastAddedMedia and cpm_viewLastAddedMediaFromAlbum.

1) imagelink should have a setting to link to the display page of the image (ex: http://somesite/galleries/displayimage.php?pos=-803)
2) imagelink should have a setting to call the javascript function MM_openBrWindow (this is what Coppermine does to display a large image)
3) more options should be available for the alt attribute.  I specifically would like to show the date of the image in the alt tag, but there are probably other things that would be useful to show as well.
4) add a title attribute that is identical to the alt attribute.  (Mozilla browsers don't show alt attributes on mouseover, but they do show title)

BUG? -- I'm getting a double slash between the directory and the file:  http://somesite/galleries/albums/test//testpic.jpg

BUG? -- It seems some "box" characters got added to the end of some of the files of version 0.7, probably artifacts of zipping the files.  They don't hurt too much except they do get printed on the html page when coppermine.php is included.  I'm using windows...

Thanks,
Kory

Hey Kory,

For your suggestions #1 & #3 above - those are in the works.  The ALT tag will be handled with much like the stats one... give it some text with placeholders....  "From album %a" would give "From album Summer Vacation".  A few other tags.  #1 is on my list, but it was going to be pretty intrusive, so I skipped it for now.  Starting on that one soon. 

Suggestion #4: That explains why I was never seeing them in firefox!  I'll put that one in to the next dev release.  After I will handle it the same way as the alt tag will be later.

Suggestion #3:  MM_OpenBRwindow a coppermine function? 

Thanks for the bugs... the boxes on the end are probably an artifact of my linux box converting the files to be readable by windows easily.  I think I know where I made that mistake. 

I am working on some other stuff right now that I really dont want to do... so this gives me an excuse to stop that :D

Thanks and check back later for 0.8



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

Okay, this is probably it before I just give it a 1.0 and move onto some new functionality/

Since the 0.7 release
<ul>
<li>Limiting what kinds of media to return (not music, etc) - setFilter($filters)</li>
<li>BUG Fixed: Fixed windows distrobution of end of file characters being added (probably)</li>
<li>BUG Fixed: Extra slash in link name </li>
<li>Added title attribute (same as alt attribute)</li>
<li>BUG Fixed: Frmat stats code - would fail if % was first char</li>
<li>Added ALTTAG / TITLE formatting</li>
</ul>

As for alt tags, I broke a big rule of development and added in new features after the code was frozen.  But I figure that this is small enough that I could get away with it.  If you set an alttag in your options hash you can insert place holders.

<?php $objCpm->cpm_viewLastAddedMedia(1,2,array("alttag" => "filename: %f")); ?>

Would produce alt and title tags that said "filename: myphoto.jpg".

This is the full list of available placeholders:

<p>
%p - filepath of the media<br />
%f - filename of the media<br />
%s - filesize in bytes<br />
%S - filesize in KB rounded to one decimal place
%t - title given to the media<br />
%c - caption for the media<br />
%o - owner name for the media<br />
%w - when added (reformatted ctime field)<br />
%W - raw Ctime field data (seconds)
%h - hits for the media<br />
%a - album name it belongs in<br />
%d - album description<br />
%% - inserts one % sign<br />
</p>

I plan on using the same for the subtitle generation in a near future release.

Credit to KaptainKory for two bug reports :D

THE DOWNLOADS are either on the first post in this thread
http://forum.coppermine-gallery.net/index.php?topic=12679.0

Or on my website at:

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

Thanks!













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

Quote from: kaptainkory on December 30, 2004, 11:42:40 PM
1) imagelink should have a setting to link to the display page of the image (ex: http://somesite/galleries/displayimage.php?pos=-803)
2) imagelink should have a setting to call the javascript function MM_openBrWindow (this is what Coppermine does to display a large image)

Let me know if you have any ideas on this thing about linking to the intermediate photos.  I have tried to keep my database access very light and very fast.  I am having trouble coming up with a single sql statement that will give me the data I need back.  I need to know the position in the album, but that is calculated by a sql call to get all the photos in an album.  This means that I have to do 1 + 1 per image calls to the database.  That is bad.  Hopefully I will be able to work some sql magic...

As for the MMOpenBrowser code... that is part of the coppermine javascript library.  I try to not tie to the actual coppermine implementation as much as possible (less work between releases probably - works on more versions) so I don't want to add that in directly.  I'm going to work in something so you can pass javascript commands to the CF program.  That way you can import the JS from coppermine in your page if you want and craft the javascript call and pass it in.  I think that will get you where you want to go.

As for now, I may tinker with the SQL, but I wont get either of those in until after this one is released as 1.0.  I want a stable version :) - but that should only be a few days anyway.

I hope I hit everything you could want in the ALT tag formatting :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

kaptainkory

The new alt and title tag features are great.  I agree that calling a javascript function straight from Coppermine is probably a bad idea, however replicating the same action isn't.  What Coppermine seems to do--without looking at the code too closely--is to open a pop-up window (without menus, status bar, etc.) that is sized to match the image AND centers it on the screen.  These are nice features beyond just using target="_blank".

Also, you seem to have fixed the end-of-file "artifacts".  I might make one more suggestion about the overall package: put everything (including docs, README, etc.) into one folder: CoppermineFetch.  This way, the whole package can just be unzipped to the directory where you want it and it all stays together; no risk of overriding an unrelated REAME file or docs folder.

This is a cosmetic thing, but the html code produced by the script has a LOT of extra spaces and tabs.  Some of these are the result of unspecified variables (ex: $linkStyle), which does not bother me.  But there is quite a bit of trimming up beyond this that could be done.  Some people, like myself  :), like to look at what html produced.

Finally, here is my solution for linking to the intermediate photos:

In coppermine_doa.php, line 48, add "p.pid" to the END of the query string:
var $sqlPictureAlbumSelect = ' p.filepath, p.filename, p.aid, p.filesize, p.title, p.caption, p.owner_name, p.ctime, p.hits, a.title, a.description, p.pid ';

In coppermine.php, starting at line 620, after the check for 'large', add the following code:
elseif ($imagelink == 'intermediate') {
$linkhtmlstart = '<a href="' . $this->urltocpm . '/displayimage.php?pos=-' . $row[11] . '" " ' . $linkStyle . $linktarget .' >';
$linkhtmlend = '</a>';
}


Now the intermediate page can be called simply by setting 'imagelink'=>'intermediate'.  However, this to me seems like more of a DEFAULT action.  Perhaps you would consider making 'imagelink'=>'none' a special action and opening the intermediate page as the default.

Cheers,
Kory

vuud

Quote from: kaptainkory on December 31, 2004, 08:13:38 PM
Also, you seem to have fixed the end-of-file "artifacts".  I might make one more suggestion about the overall package: put everything (including docs, README, etc.) into one folder: CoppermineFetch.  This way, the whole package can just be unzipped to the directory where you want it and it all stays together; no risk of overriding an unrelated REAME file or docs folder.

This is a cosmetic thing, but the html code produced by the script has a LOT of extra spaces and tabs.  Some of these are the result of unspecified variables (ex: $linkStyle), which does not bother me.  But there is quite a bit of trimming up beyond this that could be done.  Some people, like myself  :), like to look at what html produced.

Finally, here is my solution for linking to the intermediate photos:

In coppermine_doa.php, line 48, add "p.pid" to the END of the query string:
var $sqlPictureAlbumSelect = ' p.filepath, p.filename, p.aid, p.filesize, p.title, p.caption, p.owner_name, p.ctime, p.hits, a.title, a.description, p.pid ';

In coppermine.php, starting at line 620, after the check for 'large', add the following code:
elseif ($imagelink == 'intermediate') {
$linkhtmlstart = '<a href="' . $this->urltocpm . '/displayimage.php?pos=-' . $row[11] . '" " ' . $linkStyle . $linktarget .' >';
$linkhtmlend = '</a>';
}


Now the intermediate page can be called simply by setting 'imagelink'=>'intermediate'.  However, this to me seems like more of a DEFAULT action.  Perhaps you would consider making 'imagelink'=>'none' a special action and opening the intermediate page as the default.

Well that seems like a simple enough solution.  I poked at that before, but did it without the - sign, which does not work. That is way to simple to not put in the final release.  And, yes - that one should definately be the default.

As for the extra spaces I will get around to that, but its not high on my priority list.  A lot of it is due to using straight html in the php library which I can fix pretty easily.   Legacy code... you know the deal.

The EOF characters were being generated by a setting I had in my ANT build file.  I adjusted it - glad to hear they are gone.

I am unsure about changing the packaging... I did it that way exactly for the reverse of what you are saying... I wanted to keep the rest of the stuff out of the installation :)  I will give this some more thought though - I can see benefits to both ways.

Thanks for the notes and the solution to the intermediate file... If I had a bigger ego I would be incredibly embarrassed that I missed that :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