Advanced search  

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

Pages: 1 [2]   Go Down

Author Topic: UPGRADED: Cut-and-paste linking codes (HTML, bbCode, bookmark/tag)  (Read 56506 times)

0 Members and 1 Guest are viewing this topic.

thejake420

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 79
  • Jakes Jokes - the largest joke site on the web
    • Jakes Jokes
Re: Working: Cut-and-paste linking codes (HTML and bbCode)
« Reply #20 on: May 08, 2006, 03:56:15 am »

Here's the working version of codebase.php, with the following features:

1. Just the absolute URL (plain)
2. HTML title link, no thumb
3. HTML with thumb and title link (CPMFetch version... It is commented out, but it works perfectly if you want it)
4. HTML with thumb and title link (standalone version)
5. bbCode with thumbnail, no text
6. bbCode with thumbnail and title link
7. bbcode title link, no thumb (title is the anchor text)

Tip to non-gurus: Remember that if you add a comment inside of function bbcode_add_data($pic_data), you need to use this method
Code: [Select]
<!-- comment -->because the typical PHP comment such as
Code: [Select]
// commentwill still display as text and not an invisible comment.

Code: [Select]
<?php
if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');
include (
"http://www.jakesjokes.com/gallery/include/functions.inc.php");
// Create the BBcode with link to thumbnail 
$bbcodethumb_url get_pic_url($CURRENT_PIC_DATA'thumb');

// Add a filter
$thisplugin->add_filter('file_data','bbcode_add_data');
function 
bbcode_add_moredata($pic_data){ //$pic_data

$thumb_url get_pic_url($pic_data'thumb');
$fullsized_url get_pic_url($pic_data);
$normal_url get_pic_url($pic_data'normal');

$pic_data['html'] = $thumb_url.'<br>'.$fullsized_url.'<br>'.$normal_url.'<br>'.$pic_data['html']; 
return $pic_data//return $pic_data
}


function 
bbcode_add_data($pic_data){

$event = isset($_GET['event']) ? $_GET['event'] : null;
switch ($event) {
    
case 'show_bbcode':
//Define Thumbnail image URL, as called from gallery (ie - albums/10001/thumb_picture.jpg)
$thumb_url get_pic_url($pic_data'thumb');
//Define Fullsized image URL, as called from gallery (ie - albums/10001/thumb_picture.jpg)
$fullsized_url get_pic_url($pic_data);
//Define Intermediate image URL, as called from gallery (ie - albums/10001/thumb_picture.jpg)
$normal_url get_pic_url($pic_data'normal'); $display_data =  <<<EOT
<table>
<tr>
<td>
<!-- Generate code for absolute URL of intermediate pictures page (ie - displayimage.php?pos=-1234) -->
<strong>Permanent URL:</strong><br><textarea name="textarea" cols="50" rows="2">
http://www.jakesjokes.com/gallery/displayimage.php?pos=-
{$pic_data['pid']}</textarea>
<br>
<!-- Generate HTML code linking thumbnail to intermediate picture page (ie - displayimage.php?pos=-1234) -->
<!-- This version currently requires CPMFetch - See below for stand alone version -->
<!-- BEGIN commenting out CPMFetch version
<strong>HTML Linking code:</strong> (With Thumbnail)<br><textarea name="textarea" cols="50" rows="6">
&lt;iframe SRC=&quot;http://www.jakesjokes.com/specificoffsite.php?item=
{$pic_data['pid']}&quot; TITLE=&quot;Free funny jokes, videos, and pictures at JakesJokes.com&quot; WIDTH=&quot;135&quot; HEIGHT=&quot;160&quot; FRAMEBORDER=&quot;0&quot; SCROLLING=&quot;no&quot;&gt;&lt;/iframe&gt;</textarea>
<br>
END editing out CPMFetch version -->
<!-- Generate HTML code linking thumbnail to intermediate picture page (ie - displayimage.php?pos=-1234) -->
<!-- This version DOES NOT require CPMFetch -->
<strong>HTML Linking code:</strong> (With Thumbnail)<br><textarea name="textarea" cols="50" rows="8">
&lt;a href=&quot;http://www.jakesjokes.com/gallery/displayimage.php?pos=-
{$pic_data['pid']}&quot; TITLE=&quot;Free funny jokes, videos, and pictures at JakesJokes.com&quot;&gt;&lt;img src=&quot;http://www.jakesjokes.com/gallery/{$thumb_url}&quot; WIDTH=&quot;100&quot; HEIGHT=&quot;100&quot;&gt;&lt;br&gt;{$pic_data['title']}&lt;/a&gt;
</textarea>
<br>
<!-- Generate HTML code linking text to intermediate picture page (ie - displayimage.php?pos=-1234) -->
<strong>HTML Linking code:</strong> (Without Thumbnail)<br><em>Tip</em> - You can edit &quot;Funny video or picture&quot; to say whatever you want)<br><textarea name="textarea" cols="50" rows="5">
&lt;a href=&quot;http://www.jakesjokes.com/gallery/displayimage.php?pos=-
{$pic_data['pid']}&quot; title=&quot;Free funny jokes, videos, and pictures at JakesJokes.com&quot; target=&quot;_blank&quot;&gt;Funny video or picture&lt;/a&gt;</textarea>
<br>
<strong>Forum bbCode:</strong> (Thumb and title)<br><textarea name="textarea" cols="50" rows="6">
[url=http://www.jakesjokes.com/gallery/displayimage.php?pos=-
{$pic_data['pid']}][img]http://www.jakesjokes.com/gallery/{$thumb_url}[/img]
{$pic_data['title']}[/url]
</textarea>
<br>
<strong>Forum bbCode:</strong> (Thumb only)<br><textarea name="textarea" cols="50" rows="4">
[url=http://www.jakesjokes.com/gallery/displayimage.php?pos=-
{$pic_data['pid']}][img]http://www.jakesjokes.com/gallery/{$thumb_url}[/img][/url]</textarea>
<br>
<strong>Forum bbCode:</strong> (Title text only)<br><textarea name="textarea" cols="50" rows="2">
[url=http://www.jakesjokes.com/gallery/displayimage.php?pos=-
{$pic_data['pid']}]{$pic_data['title']}[/url]</textarea>
</td>
</tr>
</table>
EOT;
break;

default : 
$referer = ($_SERVER['PHP_SELF'] . (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING'] ? '?' $_SERVER['QUERY_STRING'] : ''));
$display_data =  <<<EOT
<table>
<tr>
<td>
<a href="
{$referer}&event=show_bbcode"><h2><font color="blue"><u>Link to this!</u></font></h2></a>
</td>
</tr>
</table>
EOT;
break;
}
$pic_data['html'] = $display_data.$pic_data['html'];
return $pic_data;
}
?>


thejake420

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 79
  • Jakes Jokes - the largest joke site on the web
    • Jakes Jokes
Re: UPGRADED: Cut-and-paste linking codes (HTML, bbCode, bookmark/tag)
« Reply #21 on: May 12, 2006, 05:11:41 am »

Ok, I've done a huge upgrade to the script, and it is now ready for (almost) any site.

Live demo:
http://www.jakesjokes.com/gallery/displayimage.php?pos=-8734

Image example:
(http://www.jakesjokes.com/img/mod_example.gif)


Due to the fact that, despite the help I've been given, I'm still not confident working with $SERVER and so forth to identify a server dynamically, I've coded a little bit of this with my own variables. As such, you'll need to make some extremely minor edits (type in your gallery URL, etc.) in the clearly marked section shown below
Code: [Select]
// ------------------
// BEGIN USER EDIT
// ------------------

You'll also need to upload a folder containing the graphics (the buttons, see attached file) used with this mod. The attached ZIP file contains a folder containing everything you need. Upload the ENTIRE contents of the ZIP file (the folder called "tags" and everything inside of it) to yoursite.com/gallery/plugins/(upload_here)

Note: The bookmark and tag buttons (should) work without any edits except for the variables (see "BEGIN USER EDIT" comments above), but the HTML and bbCode linking codes still require editing hardcoded URLs.

See the included readme for more detailed instructions.

EDIT: The attached ZIP file has been updated to version 1.0.1 (at 3:39 AM EST, Friday May 12, 2006) to fix a minor syntax issue in the "Thumb and title" version of the bbCode (it was formatted incorrectly, and didn't work properly in forums). 2 people downloaded the file before it was updated... Please redownload this version.


Jake
« Last Edit: May 12, 2006, 09:39:54 am by thejake420 »
Logged

Bullmax

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 49
Re: UPGRADED: Cut-and-paste linking codes (HTML, bbCode, bookmark/tag)
« Reply #22 on: May 18, 2006, 02:48:37 am »

Just downloaded and will install.
Exactly what I was looking for.  Hope all works out and will report when done.

Thanks for making this plugin!
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: UPGRADED: Cut-and-paste linking codes (HTML, bbCode, bookmark/tag)
« Reply #23 on: May 18, 2006, 05:55:14 am »

Glad you like it. However, it's not a plugin, but a mod. A plugin makes use of coppermine's plugin API that was introduced in cpg1.4.0. A Mod requires hacking the code instead.
Logged

thejake420

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 79
  • Jakes Jokes - the largest joke site on the web
    • Jakes Jokes
Re: UPGRADED: Cut-and-paste linking codes (HTML, bbCode, bookmark/tag)
« Reply #24 on: May 18, 2006, 06:07:02 am »

A plugin makes use of coppermine's plugin API that was introduced in cpg1.4.0. A Mod requires hacking the code instead.
Good point. The next version, however, will be completely plug and play (ie - no modification required by the user at all). The only thing needed to get to that step is that I need to use $SERVER(etc) instead of harcoding URLs. (I'm sure there are a million pages on that issue, so I'll definitely get to it when I have the time.)


Jake

thejake420

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 79
  • Jakes Jokes - the largest joke site on the web
    • Jakes Jokes
Re: UPGRADED: Cut-and-paste linking codes (HTML, bbCode, bookmark/tag)
« Reply #25 on: May 23, 2006, 11:39:01 pm »

How do I set the path? (ie - site.com/gallery/displayimage.php)
Currently, I'm using
Code: [Select]
$url = "http://" . $_SERVER["HTTP_HOST"] . $_SERVER["DOCUMENT_ROOT"] . $_SERVER["PHP_SELF"] . "?pos=-{$pic_data['pid']}";

But that's giving me a server path instead of a folder...
Code: [Select]
http://www.jakesjokes.com/home/vcdhelp2/public_html/jokesdisplayimage.php?pos=-9527

Obviously, the "home/vcdhelp2/public_html/jokes" should be replaced with the location of the gallery relative to the site's root directory, not the server's root... and I can't hardcode it to "gallery/" because not everybody has it set up there.

Tranz

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Female
  • Posts: 6149
Re: UPGRADED: Cut-and-paste linking codes (HTML, bbCode, bookmark/tag)
« Reply #26 on: May 24, 2006, 04:53:26 am »

You can use:
$CONFIG["ecards_more_pic_target"]
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Working: Cut-and-paste linking codes (HTML and bbCode)
« Reply #27 on: May 24, 2006, 07:43:17 am »

the URL to the gallery is defined in
$CONFIG['ecards_more_pic_target']

 ;)

thejake420

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 79
  • Jakes Jokes - the largest joke site on the web
    • Jakes Jokes
Re: UPGRADED: Cut-and-paste linking codes (HTML, bbCode, bookmark/tag)
« Reply #28 on: May 24, 2006, 09:57:39 am »

I know, but it wasn't working exactly as I wanted for my specific needs. I ended up with a PHP workaround.

Code: [Select]
// Automatically grab and encode the absolute URL
$url = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
$url = preg_replace('/\?(.*)/','',$url);
$url = urlencode($url);

It looks a little bass-ackwards, but it works wonderfully.

PS - I've gotten so into this mod that I actually abandoned it in favor of a completely new version (which is finished and tested... just adding some comments, etc.) I put so much into it that actually developed a whole new website for the sole purppose of handling the backend of this new (and well-coded this time) plugin.

When I get into something, I get into something. ;)


Jake

thejake420

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 79
  • Jakes Jokes - the largest joke site on the web
    • Jakes Jokes
Re: UPGRADED: Cut-and-paste linking codes (HTML, bbCode, bookmark/tag)
« Reply #29 on: May 24, 2006, 11:30:09 am »

This modification has been abandoned (at least by me) in favor of a better coded, more useful, true "plug and play" plugin I've created.

Here is the thread for the new plugin.


Jake

Bullmax

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 49
Re: UPGRADED: Cut-and-paste linking codes (HTML, bbCode, bookmark/tag)
« Reply #30 on: February 02, 2007, 09:47:08 pm »

I have a question that might sound dumb.

If someone uploads a video clip, is there a way to have the bbcode change to in place of the image tags?  Something like an esle if.
Logged

nasirmulani

  • Coppermine newbie
  • Offline Offline
  • Posts: 6
  • *Banned*
Re: UPGRADED: Cut-and-paste linking codes (HTML, bbCode, bookmark/tag)
« Reply #31 on: February 18, 2007, 07:43:13 am »

the bbcode that this plugin generates, uses a direct link ie. it links to jpg file directly.

i am loking for some thing like the various photo hosting sites do. they have link to a .html file and not the pic directly. which in turn displays the thumbnail and links the site.

i dont want any direct link to any of my pictures.

thejake420  you can help you see to be the guru. plz look in to this

thanks
Logged
Pages: 1 [2]   Go Up
 

Page created in 0.025 seconds with 19 queries.