UPGRADED: Cut-and-paste linking codes (HTML, bbCode, bookmark/tag) - Page 2 UPGRADED: Cut-and-paste linking codes (HTML, bbCode, bookmark/tag) - Page 2
 

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

UPGRADED: Cut-and-paste linking codes (HTML, bbCode, bookmark/tag)

Started by thejake420, April 03, 2006, 08:30:49 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

thejake420

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
<!-- comment -->
because the typical PHP comment such as
// comment
will still display as text and not an invisible comment.


<?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

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:
(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.jakesjokes.com%2Fimg%2Fmod_example.gif&hash=057da49c90fe04c5d23e69fa50ab28321bae2ad1)


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

// ------------------
// 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

Bullmax

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!

Joachim Müller

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.

thejake420

Quote from: GauGau on May 18, 2006, 05:55:14 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

How do I set the path? (ie - site.com/gallery/displayimage.php)
Currently, I'm using

$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...

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


Stramm


thejake420

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


// 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

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

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.

nasirmulani

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