forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 cpmFetch by vuud => Topic started by: remdex on March 21, 2007, 07:28:24 pm

Title: Simple Javascript plugin for cpmFetch
Post by: remdex on March 21, 2007, 07:28:24 pm
Hi everybody,

I had ceople free hours and developed simple plugin for cpmFetch.  Which help you can include images from your gallery to any website just with ceople lines of javascript. (Plugin tested with 1.9.11) Version.

1. How everything works ?

First download package from http://animeonly.org/cpfetch/cpmfetchjs.zip

Package contains five files:
README.txt - Simple explanation about plugin
jsfetch.php - Server side javascript generation.(put it in cpmfetch directory)

In general it's not needed to modificate these files if you won't fetch last hits.
cpmfetch_dao.php - Added one function tu get lasthits. 639 - Line function getMostViewedMediaFrom(....
cpmfetch.php - Added function. cpm_viewMostViewedMediaFrom 818 - cpm_viewMostViewedMediaFrom(....

javascripttest.html - User side example. File contais simple javascript inside :) With detailed explanation.

Live example how it works:
http://animeonly.org/javascripttest.html - Fetches random images from suplied category (In this case 4)

More examples:
Last hits example - http://animeonly.org/lasthits.html
Top rated example - http://animeonly.org/toprated.html
Last media example - http://animeonly.org/lastmedia.html

So with javascript you can fetch any images from remote galery. Just with ceople lines of javascript and no php integration needed in remote site. I hope for someone it will be useful  ;D


P.s Sory for my crappy english :D.
Title: Re: Simple Javascript plugin for cpmFetch
Post by: vuud on March 21, 2007, 07:56:52 pm
Hi everybody,

I had ceople free hours and developed simple plugin for cpmFetch.  Which help you can include images from your gallery to any website just with ceople lines of javascript. (Plugin tested with 1.9.11) Version.

1. How everything works ?

First download package from http://animeonly.org/cpfetch/cpmfetchjs.zip

Package contains five files:
README.txt - Simple explanation about plugin
jsfetch.php - Server side javascript generation.(put it in cpmfetch directory)

In general it's not needed to modificate these files if you won't fetch last hits.
cpmfetch_dao.php - Added one function tu get lasthits. 639 - Line function getMostViewedMediaFrom(....
cpmfetch.php - Added function. cpm_viewMostViewedMediaFrom 818 - cpm_viewMostViewedMediaFrom(....

javascripttest.html - User side example. File contais simple javascript inside :) With detailed explanation.

Live example how it works:
http://animeonly.org/javascripttest.html - Fetches random images from suplied category (In this case 4)

More examples:
Last hits example - http://animeonly.org/lasthits.html
Top rated example - http://animeonly.org/toprated.html
Last media example - http://animeonly.org/lastmedia.html

So with javascript you can fetch any images from remote galery. Just with ceople lines of javascript and no php integration needed in remote site. I hope for someone it will be useful  ;D


P.s Sory for my crappy english :D.

Sounds like a cool thing. 

Can you PM me your email address?  I'd like to work it out so you do not require cpmfetch to be mod'ed.  I can probably add in what you need, unless its not a good thing.

While I cannot stop you from redistributing cpmfetch, it is a bad practice if we can avoid it.

See my developers page at http://cpmfetch.fistfullofcode.com

Excellent to see development happening!

Vuud

Title: Re: Simple Javascript plugin for cpmFetch
Post by: vuud on April 10, 2007, 11:14:19 pm

Wow, I just noticed that you have over 100,000 files in your gallery... any chance I could get a copy of the database for testing CpmFetch on?  I don't need the images, just a database dump.

Wow.

I have one now for testing that is 20,000.
Title: Re: Simple Javascript plugin for cpmFetch
Post by: Gizmo on April 11, 2007, 05:26:56 pm
This is quite awesome! Thanks for sharing.
Title: Re: Simple Javascript plugin for cpmFetch
Post by: remdex on April 11, 2007, 05:32:44 pm
I have sent PM to you vuud. Have you received it ?
Title: Re: Simple Javascript plugin for cpmFetch
Post by: vuud on April 11, 2007, 08:07:14 pm
I have sent PM to you vuud. Have you received it ?

No, I have not received any PM's from you.  I will PM you my email address.
Title: Re: Simple Javascript plugin for cpmFetch
Post by: JohnJohn on April 14, 2007, 06:35:28 am
Very interesting

I hope you gave further details on how to install it, because your readme is very ... short. That's probably clear for coders, but when you're not, ...

By the way, will this work with last CPM version (2.0) ?
Title: Re: Simple Javascript plugin for cpmFetch
Post by: vuud on April 14, 2007, 06:42:21 am
Very interesting

I hope you gave further details on how to install it, because your readme is very ... short. That's probably clear for coders, but when you're not, ...

By the way, will this work with last CPM version (2.0) ?

Changes from 1.9.9 up to 2.0.0 are very minimal and should not affect his script


Vuud
Title: Re: Simple Javascript plugin for cpmFetch
Post by: remdex on April 14, 2007, 03:58:01 pm
I'will try during next week make update for 2.0v of cpmFetch. With more detailed instructions..
Title: Re: Simple Javascript plugin for cpmFetch
Post by: vuud on April 14, 2007, 04:21:40 pm
I'will try during next week make update for 2.0v of cpmFetch. With more detailed instructions..

Would you be willing to simply extend the Cpmfetch object instead of creating new version of the cpmfetch_dao ?

That way you would not be dependent on updating your functions with each version...

Just a thought

I'd be willing to give some advice and advisement on how to do it.
Title: Re: Simple Javascript plugin for cpmFetch
Post by: remdex on April 14, 2007, 05:24:08 pm
Would you be willing to simply extend the Cpmfetch object instead of creating new version of the cpmfetch_dao ?

That way you would not be dependent on updating your functions with each version...

Just a thought

I'd be willing to give some advice and advisement on how to do it.

Nice idea. I do it your way :)
Title: Re: Simple Javascript plugin for cpmFetch
Post by: vuud on April 14, 2007, 05:29:17 pm
Nice idea. I do it your way :)

Let me know if you need help.  I designed it so you "should" be able to extend the cpm object and just add in your own calls.

Title: Re: Simple Javascript plugin for cpmFetch
Post by: remdex on April 14, 2007, 06:00:01 pm
So i did it your way, it was really easy  ;D

So new package can be downloaded from:

http://animeonly.org/cpmfetch/plugins/cpmfetchjs.zip (http://animeonly.org/cpmfetch/plugins/cpmfetchjs.zip)

And install is easy now, even for beginners.

1. Download pacakge
2. Unzip archive and put "cpmfetchjs" folder to plugins directory. Path should look similar to this <cpmfetch direcotry>/plugins/cpmfetchjs
3. Play with javascripttest.html . Until it fits your needs. NO php file modifications required

Javascript source and live demonstration:
http://animeonly.org/cpmfetch/plugins/cpmfetchjs/javascripttest.html (http://animeonly.org/cpmfetch/plugins/cpmfetchjs/javascripttest.html)

Title: Re: Simple Javascript plugin for cpmFetch
Post by: vuud on April 14, 2007, 06:36:40 pm
So i did it your way, it was really easy  ;D

So new package can be downloaded from:

http://animeonly.org/cpmfetch/plugins/cpmfetchjs.zip (http://animeonly.org/cpmfetch/plugins/cpmfetchjs.zip)

And install is easy now, even for beginners.

1. Download pacakge
2. Unzip archive and put "cpmfetchjs" folder to plugins directory. Path should look similar to this <cpmfetch direcotry>/plugins/cpmfetchjs
3. Play with javascripttest.html . Until it fits your needs. NO php file modifications required

Javascript source and live demonstration:
http://animeonly.org/cpmfetch/plugins/cpmfetchjs/javascripttest.html (http://animeonly.org/cpmfetch/plugins/cpmfetchjs/javascripttest.html)


Fantastic!  And congradulations!  You are the first person (aside from me) to extend cpmfetch the way it was designed!

A new era of CpmFetch has begun!


Title: Re: Simple Javascript plugin for cpmFetch
Post by: thaDRAGON on May 11, 2007, 01:23:32 am
this mod is so cool!!!

I wonder if i can use the owner variable together with it.

like in the example:

"cat=5,3:album=10:owner=vuud"

Title: Re: Simple Javascript plugin for cpmFetch
Post by: Wolfegar on May 24, 2007, 01:46:02 am
Greetings, remdex.

I've been playing around a bit with your JavaScript add-on to vuud's add-on for the Coppermine Gallery.  With it I was able to get a couple of pictures from my Gallery to show up on my IPB 1.3.x forum.  The board wrapper is either html or xhtml or something.  Anyway, the cpmFetch stuff wouldn't execute from there.  I was going to use the cfimageget.php file, but I still can't get that thing to work for some reason.  And I don't think it work in the board wrapper anyway.

So, I was wondering, would this:

Code: [Select]
$options = array("subtitle" => "{{pTitle}}","cellattributes" => array('align' => 'center','valign' => 'center','width' => '75'));
work with your JavaScript to retrieve the image's title and do the center aligns?  I presume I'd have to use a different format for the JavaScript call.  I didn't see anything for the title.  I did find the "random" code you'd commented out.  But my database is far smaller than yours so I removed the comment to activate that part again.
Title: Re: Simple Javascript plugin for cpmFetch
Post by: Pakistani1 on June 03, 2007, 08:28:34 pm
i was thinking of doing the same
Title: Re: Simple Javascript plugin for cpmFetch
Post by: tibski on June 24, 2007, 02:23:44 pm
I tried installing this javascript but sad to say i get an error.

http://lasalleiligan.org/lsa/lsagallery/cpmfetch/plugins/cpmfetchjs/jsfetch.php

and when I tried placing the code in my ipb forum the pics doesn't appear.

thanks....hope someone can help me out.
Title: Re: Simple Javascript plugin for cpmFetch
Post by: remdex on June 25, 2007, 06:16:39 pm
I tried installing this javascript but sad to say i get an error.

http://lasalleiligan.org/lsa/lsagallery/cpmfetch/plugins/cpmfetchjs/jsfetch.php

and when I tried placing the code in my ipb forum the pics doesn't appear.

thanks....hope someone can help me out.

Generaly, you should not access with your browser to jsfetch.php file directly. Picture is generated with javascript, not php itself.
In your case picture generating javascript could look like :

Code: [Select]
<script type="text/javascript">
var cpr_albumid=''; //album id if not used set ''
var cpr_catid='1';   //Category id if not used set ''
var resulttype = 'lasthits'; //Result type from below array.
/*Result types:

'toprated', //Fetches top rated
'mostviewedrated', //Fetches most viewed rated
'lastmedia', //Fetched last media
'lastmediafromalbum', //Fetched last uploads from suplied album ID
'lastmediafromcat', //Fetched last uploads from suplied category ID
'randomfromalbum', //Fetched random files suplied album ID
'randomfromcategory', //Fetched random files from suplied category ID
'lasthits' //If suplied cpr_albumid fetched last hits form album if category then last hits from category.
*/

var rows=8; //Number of rows
var col=1; //Number of columns
var jscriptFetchFile='http://lasalleiligan.org/lsa/lsagallery/cpmfetch/plugins/cpmfetchjs/jsfetch.php';
/*
StylesGenerated with table
'tablestyle' => 'cpr_tablestyle',
'tableheadstyle'=> 'cpr_tableheadstyle',
'rowstyle' => 'cpr_rowstyle',
'cellstyle' => 'cpr_cellstyle',
'imagestyle' => 'cpr_imagestyle',
'linkstyle' => 'cpr_linkstyle'
*/
</script>

<script type="text/javascript">
document.write("<script type=\"text/javascript\" src=\""+jscriptFetchFile+"?albumid="+cpr_albumid+"&catid="+cpr_catid+"&resulttype="+resulttype+"&rows="+rows+"&col="+col+"\"><\/script>");
</script>

Just tried with you gallery. Html source is the same like above code.
http://animeonly.org/help.html
Title: Re: Simple Javascript plugin for cpmFetch
Post by: erratikmind on June 26, 2007, 12:58:15 pm
is there a code to display last updated albums...so it shows how it does in coppermine, the last albums updated.
Title: Re: Simple Javascript plugin for cpmFetch
Post by: tibski on June 26, 2007, 01:56:36 pm
Generaly, you should not access with your browser to jsfetch.php file directly. Picture is generated with javascript, not php itself.
In your case picture generating javascript could look like :

Code: [Select]
<script type="text/javascript">
var cpr_albumid=''; //album id if not used set ''
var cpr_catid='1';   //Category id if not used set ''
var resulttype = 'lasthits'; //Result type from below array.
/*Result types:

'toprated', //Fetches top rated
'mostviewedrated', //Fetches most viewed rated
'lastmedia', //Fetched last media
'lastmediafromalbum', //Fetched last uploads from suplied album ID
'lastmediafromcat', //Fetched last uploads from suplied category ID
'randomfromalbum', //Fetched random files suplied album ID
'randomfromcategory', //Fetched random files from suplied category ID
'lasthits' //If suplied cpr_albumid fetched last hits form album if category then last hits from category.
*/

var rows=8; //Number of rows
var col=1; //Number of columns
var jscriptFetchFile='http://lasalleiligan.org/lsa/lsagallery/cpmfetch/plugins/cpmfetchjs/jsfetch.php';
/*
StylesGenerated with table
'tablestyle' => 'cpr_tablestyle',
'tableheadstyle'=> 'cpr_tableheadstyle',
'rowstyle' => 'cpr_rowstyle',
'cellstyle' => 'cpr_cellstyle',
'imagestyle' => 'cpr_imagestyle',
'linkstyle' => 'cpr_linkstyle'
*/
</script>

<script type="text/javascript">
document.write("<script type=\"text/javascript\" src=\""+jscriptFetchFile+"?albumid="+cpr_albumid+"&catid="+cpr_catid+"&resulttype="+resulttype+"&rows="+rows+"&col="+col+"\"><\/script>");
</script>

Just tried with you gallery. Html source is the same like above code.
http://animeonly.org/help.html


thanks remdex. I finally got it to work.

Just one question more...i placed the code in a <frame>, Is is possible that when you click on the picture being displayed it opens on the "parent" page not in the "frame" itself?

thanks
Title: Re: Simple Javascript plugin for cpmFetch
Post by: erratikmind on July 05, 2007, 01:51:07 pm
Quote
Just one question more...i placed the code in a <frame>, Is is possible that when you click on the picture being displayed it opens on the "parent" page not in the "frame" itself?

i want to know also...anyone know?
Title: Re: Simple Javascript plugin for cpmFetch
Post by: MastiMasti on July 17, 2007, 10:30:03 pm
1st Thanks to Remdex
this mod is perfect
and work fine

I install it last night and work fine

I tried RANDOM, lasthits, lastadded
everything work fine and even I add TWICE code on same page it still work fine


now I like to ask something REMDEX

Is there anyway pictures/wallpapers can be open in new page?
when someone click on it and it's open in new page?



if yes please provide some info about it

2nd if not
are you looking forwed to work on that?


because if we have newpage (open in newpage) than many users can provide code
to other who can use their websites ;)



thanks again
waiting for your reply

Sunny
Title: Re: Simple Javascript plugin for cpmFetch
Post by: remdex on July 20, 2007, 08:42:10 pm
I will see, what i can do, about new page.
Title: Re: Simple Javascript plugin for cpmFetch
Post by: remdex on July 20, 2007, 09:14:48 pm
New version with requested feature can be downloaded from:

http://animeonly.org/cpmfetch/plugins/cpmfetchjs.zip (http://animeonly.org/cpmfetch/plugins/cpmfetchjs.zip)

Was done a little modification to jsfetch.php file and javascripttest.html
Adden one more variable to javascripttest.html file. So just see source.
Everything else is the same. Just download and enjoy.
Live demonstration:
http://animeonly.org/cpmfetch/plugins/cpmfetchjs/javascripttest.html (http://animeonly.org/cpmfetch/plugins/cpmfetchjs/javascripttest.html)
Title: Re: Simple Javascript plugin for cpmFetch
Post by: MastiMasti on July 22, 2007, 04:28:50 am
 :o to quick


thansk RemDex

You ROCKS !

"1 Means open in new window 0 open in current window"

work PERFECT  :)


thanks again
Title: Simple Javascript plugin for cpmFetch and Joomla integration
Post by: cgc0202 on August 01, 2007, 03:33:06 am
I was following this thread a bit, but I have not responded to it yet because I wanted to create a mock up page for Joomla and modules that were made for Joomla.

Anyway, what I can do right now is add images into a Joomla page, using PHP codes through the CPMFetch, directly into the index.php -- without having the CPMFetch integrated as a module in Joomla (see note below).  What I did is illustrated in this site (http://likas-philippines.org/joomla001/)

There is only one catch, since the CPMFetch PHP scripts weres added to the [ur=http://treasuresoftheinternet.org/layout/joomla-likas-site-template.shtml]index.php[/url], the dynamic images would be present in all pages (please see note below).  This global (all pages) integration is not always desirable.

What is more desirable is whether it is possible to integrate the dynamic images, using CPMFetch into specific pages, or specific articles -- as shown in this mock up layout (http://treasuresoftheinternet.org/layout/toti-joomla-layout03.shtml) -- using the javascript developed and presented in this forum thread by remdex.

Notes:
The this mock up layout (http://treasuresoftheinternet.org/layout/toti-joomla-layout03.shtml) is just a simple html script, not the working iJoomla Magazine.

I will provide Vuud and remdex (via private email) links and access to the actual Joomla and iJoomla Magazine, in case either (or both) would consider looking at this issue.  [It might be posted as a "job request" to either Vuud and remdex only (and reclassified to the job request forum) in case either considers it feasible and might consider exploring the suggestion, further.  Further details would be provided.  Also, there is a related issue, presented in another post (http://forum.coppermine-gallery.net/index.php?topic=45746.0), that must be considered.

Thanks.

Cornelio

__________
Note:

There is another PHP module and I already posted in the Forum  of Andre -- who developed the script  to integrate the mod to bridge CPG-CPMFetch to Joomla -- about the capabilities of his script.
Title: Re: Simple Javascript plugin for cpmFetch
Post by: Valeryn on February 29, 2008, 11:32:18 am
Thanks to Remdex
block for PHP-Nuke
http://oymiakon.ru/index.php
Title: Re: Simple Javascript plugin for cpmFetch
Post by: Joachim Müller on February 29, 2008, 05:54:23 pm
How is that related to this thread?
Title: Re: Simple Javascript plugin for cpmFetch
Post by: Valeryn on March 01, 2008, 03:04:48 am
Joachim Müller, I not dialect in english. I russian.
 It Is Installed "cpmFetch" + "Simple Javascript plugin for cpmFetch" and is written block for PHP-Nuke with code taken from javascripttest.html (little are changed)
Read on this page (http://forum.coppermine-gallery.net/index.php/topic,43414.0.html)
Title: Re: Simple Javascript plugin for cpmFetch
Post by: Valeryn on March 02, 2008, 04:50:10 am
My modification
Code: [Select]
<script type="text/javascript">
var albums=[]; //Указываются номера, если необходимо сделать выборку только из каких то конкретных альбомов
var categories=[1,2,3,4]; //Указываются номера, если необходимо сделать выборку только из каких то конкретных категорий

var cpr_albumid= albums[Math.floor(Math.random()*albums.length)];
var cpr_catid= categories[Math.floor(Math.random()*categories.length)];   
var resulttype = "randomfromcategory";               //По какому принципу производить отбор фоток
Title: Re: Simple Javascript plugin for cpmFetch
Post by: Shelia on April 16, 2008, 10:03:54 pm
Trying to find a simple solution for embedding cpmFetch into my 2.5 Wordpress installation. Any insight on how this plugin might do the trick? I'll give it a try but I was hoping that  someone else had tried and I could save myself the trouble of a futile attempt.

Thanks!
Title: Re: Simple Javascript plugin for cpmFetch
Post by: Evaligan on May 13, 2008, 03:02:13 pm
This works for SMF Forums too?
I want that when enter in my SMF Forum show the most recents images from Coppermine in thumbnails. The users do a clic and go to the gallery. My Coppermine works fine with my SMF.
Title: Re: Simple Javascript plugin for cpmFetch
Post by: kailew on October 07, 2008, 10:51:27 am
Hello,

is it possible to show intermediate pictures with the js?

Kai
Title: Re: Simple Javascript plugin for cpmFetch
Post by: imgr8 on October 15, 2008, 10:22:15 pm
Can someone please tell me how to style the pictures using this plugin? I want to add padding and a background for each image and I have wasted 2 days on it and I cant figure it out :( There's this part in the file:


/*
      StylesGenerated with table
            'tablestyle'   => 'cpr_tablestyle',
            'tableheadstyle'=> 'cpr_tableheadstyle',
            'rowstyle'      => 'cpr_rowstyle',
            'cellstyle'      => 'cpr_cellstyle',
            'imagestyle'   => 'cpr_imagestyle',
            'linkstyle'      => 'cpr_linkstyle'
   */

but how do I use it??

Any help will be appreciated, and please answer  >:(
Title: Re: Simple Javascript plugin for cpmFetch
Post by: meek on October 22, 2008, 10:33:31 pm
Hi.

Would it be possible to display just one single image from a certain album even though this album contains multiple images?

Kind regards.
Title: Re: Simple Javascript plugin for cpmFetch
Post by: edenffs on October 25, 2008, 12:13:52 am
This is an awesome mod, it has enabled me to show images from cpm in the phpbb3 profile page in the correct location.
I have only managed to display the last uploaded images from the hole gallery, Is there any way of showing the last uploaded images from the profile user id?
Title: Re: Simple Javascript plugin for cpmFetch
Post by: edenffs on October 25, 2008, 08:35:59 pm
Hi.

Would it be possible to display just one single image from a certain album even though this album contains multiple images?

Kind regards.
yes just change the rows to 1 and the columns to 1
Code: [Select]
var rows=1;   //Number of rows
var col=1;   //Number of columns
Title: Re: Simple Javascript plugin for cpmFetch
Post by: meek on October 25, 2008, 11:08:35 pm
Can someone please tell me how to style the pictures using this plugin? I want to add padding and a background for each image and I have wasted 2 days on it and I cant figure it out :( There's this part in the file:


/*
      StylesGenerated with table
            'tablestyle'   => 'cpr_tablestyle',
            'tableheadstyle'=> 'cpr_tableheadstyle',
            'rowstyle'      => 'cpr_rowstyle',
            'cellstyle'      => 'cpr_cellstyle',
            'imagestyle'   => 'cpr_imagestyle',
            'linkstyle'      => 'cpr_linkstyle'
   */

but how do I use it??

Any help will be appreciated, and please answer  >:(

I'd like to know this too...
Title: Re: Simple Javascript plugin for cpmFetch
Post by: meek on October 25, 2008, 11:23:38 pm
yes just change the rows to 1 and the columns to 1
Code: [Select]
var rows=1;   //Number of rows
var col=1;   //Number of columns
Thanks for your reply, but that's not quite what I'm after. I want to show just one image - no matter what category or album it's located in, so I guess it should be something with image ID or something. I just don't know how to code it.
Title: Re: Simple Javascript plugin for cpmFetch
Post by: imgr8 on December 18, 2008, 09:43:05 pm
I'd like to know this too...

oh I figured it out finaly. Here's how you do it, incase you still want to know :)

Open the javascripttest.htl files and add this to the top of the page

Code: [Select]

<style type="text/css">
body {  background: #000;}

.cpr_imagestyle {border: 4px solid #fff;}

</style>

In this code I just added a background color to the page and border to the images :)
Title: Re: Simple Javascript plugin for cpmFetch
Post by: cinthia85 on February 11, 2009, 11:58:10 pm
Someone can help me please???? I cant install this thing!!!!!!


cinthiaroberta@gmail.com    ::) ::) ::)
Title: Re: Simple Javascript plugin for cpmFetch
Post by: Joachim Müller on February 17, 2009, 01:40:19 pm
There's no support by email, and little sympathy for people who try to hijack other's thread without at least taking a look and board rules (http://forum.coppermine-gallery.net/index.php/topic,55415.0.html) nor the docs nor the sticky threads on this very sub-board.
Locking