Advanced search  

News:

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

Pages: 1 2 3 [4] 5 6 7 8 ... 10   Go Down

Author Topic: copy/ paste bbcode img URL below intermediate image  (Read 208542 times)

0 Members and 1 Guest are viewing this topic.

gonzojenny

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: copy/ paste bbcode img URL below intermediate image v1.1
« Reply #60 on: September 11, 2007, 07:06:11 am »

ok...so I installed the plug in and it works ...kind of

I was able to get the img src for the html and the bbcode out...but now it is giving me permission errors when I try to copyt he code into another forum..

any ideas?
« Last Edit: September 11, 2007, 07:41:25 am by gonzojenny »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: copy/ paste bbcode img URL below intermediate image v1.1
« Reply #61 on: September 11, 2007, 08:15:12 am »

Then you probably have hotlink protection set up. For details, post a link to your gallery.
Logged

gonzojenny

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: copy/ paste bbcode img URL below intermediate image v1.1
« Reply #62 on: September 11, 2007, 08:18:39 am »

no..hotlinking is allowed...always has been...

when I went to switch the codebase to the one that gives me the html code instead of bbc code it lasted about 20 minutes then my entire directory went offline...I had no access whatsoever to the directory anymore...none of my machines did

it was when I installed the one from the forums here that has this in the configuration

>--Modified by Zachary Barnes of UselessHacks.com'

almost like my gallery was hacked...was giving me 403 permission denied errors on the whole directory

I eventually had to remove and uninstall the entire directory and reinstall it to get it to go back to normal and able to be viewed again...
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: copy/ paste bbcode img URL below intermediate image v1.1
« Reply #63 on: September 11, 2007, 08:32:25 am »

it was when I installed the one from the forums here that has this in the configuration

>--Modified by Zachary Barnes of UselessHacks.com'
What are you refering to? Post a link to your source. The original plugin posted in this thread is by Stramm and contains no reference to Zachary Barnes as far as I can see.

If you want help, you should do as supporters suggest:
post a link to your gallery
Any particular reason for not doing as I suggested?
Logged

gonzojenny

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: copy/ paste bbcode img URL below intermediate image v1.1
« Reply #64 on: September 11, 2007, 08:42:01 am »

this is the one I am talking about that I installed that caused the upset

I don't really know where to post this, so hopefully this is the best place. I modified your BB code plugin so that it would display html tag links instead, and combined it with the javascript toggle display div to make it visible only when you click on a link that sits below the picture. I also removed the copy code, because it didn't support FF.

You can also easily comment out if you don't want any of the particular sizes to be displayed.

The only problem that I have is that once you click the link, you can't make it invisible again until the page reloads, because the css in

Code: [Select]
<div id="hotlinking" style="display: none; margin: 0px 20px 0px 20px;">
needs to be actually inserted into the head of the document or into an externally linked css file as:

Code: [Select]
div#hotlinking {
display: none;
margin: 0px 20px 0px 20px;
}

If anyone knows how to get around this, let me know. In the meantime, its not that big of a deal. Its more of a personal preference.

Code: [Select]
<?php
/**************************************************
  CPG BB Code Plugin for Coppermine Photo Gallery 
  Modified by Zachary Barnes of UselessHacks.com
Now creates html tags instead of BB
  *************************************************
  Copyright (c) 2006 Thomas Lange <stramm@gmx.net>
  *************************************************
  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
  *************************************************
  Coppermine version: 1.4.9
  BB Code Plugin version: 1.2
  $Revision: 1.0 $
  $Author: stramm $
***************************************************/


if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');

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


function 
bbcode_add_data($pic_data){ //$pic_data
global $CONFIG;

//Javascript to hide hotlinking information along with div arrangement, taken from a common toggling script floating around the net
$script_data = <<< EOT

<script language="javascript" type="text/javascript">
<!--
function toggleLayer(whichLayer)
{
if (document.getElementById)
{
// this is the way the standards work
var style2 = document.getElementById(whichLayer).style;
style2.display = style2.display? "":"block";
}
else if (document.all)
{
// this is the way old msie versions work
var style2 = document.all[whichLayer].style;
style2.display = style2.display? "":"block";
}
else if (document.layers)
{
// this is the way nn4 works
var style2 = document.layers[whichLayer].style;
style2.display = style2.display? "":"block";
}
}
//-->
</script>

<a href="javascript:toggleLayer('hotlinking');" title="View Hotlinking Information">View Hotlinking Information</a>
<div id="hotlinking" style="display: none; margin: 0px 20px 0px 20px;">

EOT;
    
    
$thumb_url get_pic_url($pic_data'thumb');  //here we grab the url to the thumb url
$int_url get_pic_url($pic_data'normal');  //intermediate pic
$full_url get_pic_url($pic_data'fullsize');            //fullsized pic
$pic_data['title'] ? $name $pic_data['title'] : $name 'No&nbsp;Title'//checking if the pic has a title, if not we set it to 'No title'

//Generating the file paths for each picture size

$tn_url '&lt;a&nbsp;href="'.$CONFIG['ecards_more_pic_target'].$int_url.'"&gt;&lt;img&nbsp;src="'.$CONFIG['ecards_more_pic_target'].$thumb_url.'"&nbsp;alt="'.$name.'"&nbsp;/&gt;&lt;/a&gt;';
$im_url '&lt;a&nbsp;href="'.$CONFIG['ecards_more_pic_target'].$full_url.'"&gt;&lt;img&nbsp;src="'.$CONFIG['ecards_more_pic_target'].$int_url.'"&nbsp;alt="'.$name.'"&nbsp;/&gt;&lt;/a&gt;';
$fs_url '&lt;img&nbsp;src="'.$CONFIG['ecards_more_pic_target'].$full_url.'"&nbsp;alt="'.$name.'"&nbsp;/&gt;';

//this just brings everything in form... we create a table etc., 

$bbcode_data $script_data;
$bbcode_data .= '<table align="center" width="'.$CONFIG['picture_width'].'">';

//thumbnail image code with link to intermediate image
$textarea_prop 'name="bbcode" rows="1" cols="50" style="overflow:off; white-space:nowrap" readonly="readonly"';

$bbcode_data .= '<tr><td>Thumbnail:</td></tr>';
$bbcode_data .= '<tr><td><textarea '.$textarea_prop.'>'.$tn_url.'</textarea></td></tr>';

//intermediate image code with link to fullsize image
$bbcode_data .= '<tr><td>Intermediate:</td></tr>';
$bbcode_data .= '<tr><td><textarea '.$textarea_prop.'>'.$im_url.'</textarea></td></tr>';

//fullsize image code
$bbcode_data .= '<tr><td>Fullsize:</td></tr>';
$bbcode_data .= '<tr><td><textarea '.$textarea_prop.'>'.$fs_url.'</textarea></td></tr>';

//closing table and visiblity div
$bbcode_data .= '</table></div>';



//finally we add the created stuff to the picture data and return it to coppermine
$pic_data['html'] = $pic_data['html'].$bbcode_data

return $pic_data
}

?>


EDIT: Fixed a few bugs. Now trying to find a replacement for 'wrap="off"' that validates under xhtml.

EDIT: The good news is that the above code is now XHTML valid.

Apparently, everyone is looking for a wrap=off equivalent that validates under xhtml, but it doesn't exists. So to keep all the text on one line, I've used "&nbsp;" for all of the spaces, effectively linking everything together. Unfortunately, in FF, if your picture title has a space in it, it will chop it up to two lines. IE6 works fine, and keeps everything on the same line.

So, you could increase the rows to 'rows="2"', or you could remove the 'alt="$name"' attribute, but I'm sticking with it like it is unless anyone has any work-arounds or suggestions.

if you download the batch files under his name on the particular posting...you will see that he modified stramms php codebase and had put his name in the "created by" up top

after the installation of his version of the image sourcing things went to hell in a handbasket and excuse me if I happened to forget to add this to my last bit of asking for assistance

you have no idea how annoyed I was when I had to lose over 10,000 uploaded images because the only way to get back into the gallery was to remove it from my server and put it back...simple oversight
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: copy/ paste bbcode img URL below intermediate image v1.1
« Reply #65 on: September 11, 2007, 09:02:58 am »

if you download the batch files under his name on the particular posting...you will see that he modified stramms php codebase and had put his name in the "created by" up top
Why didn't you use the original one posted by Stramm? The one you refer to is just an unsupported contribution. There's no guarantee that it works as expected.

you have no idea how annoyed I was when I had to lose over 10,000 uploaded images because the only way to get back into the gallery was to remove it from my server and put it back...simple oversight
That's complete, utter nonsense. It wouldn't have been necessary to perform a fresh install. Simply undoing the damage would have been enough. Why didn't you ask how to remove the damage instead of starting all over and then (after making that mistake) complaining?

If you want help, you should do as supporters suggest.
I will not allow you to clutter this thread with invalid rants. Do as I suggested and post a link to your gallery or stop wasting everybody's time and stop posting.
Logged

gonzojenny

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: copy/ paste bbcode img URL below intermediate image v1.1
« Reply #66 on: September 11, 2007, 09:14:52 am »

Why didn't you use the original one posted by Stramm? The one you refer to is just an unsupported contribution. There's no guarantee that it works as expected.
That's complete, utter nonsense. It wouldn't have been necessary to perform a fresh install. Simply undoing the damage would have been enough. Why didn't you ask how to remove the damage instead of starting all over and then (after making that mistake) complaining?
I will not allow you to clutter this thread with invalid rants. Do as I suggested and post a link to your gallery or stop wasting everybody's time and stop posting.


not wasting anyones time here but mine it seems

the link to my gallery since you feel you need it; http://www.gonzojenny.com/images but it is offline at the moment

and I did try to fix the problem by putting all the code back the way that it was before the plugin install and it didnt work...tried numerous times to remove all instances of the codebase for the last 4 hours BEFORE coming here to register and ask for assistance....searching for some tidbit of answers thru THIS forum and many thread strings and I found no help...

the reason i used the modified version is because it gave the img src codes that I need instead of the bbcodes which I cant use for what the gallery is intended for

and now after the fifth hour has passed I have found the problem and it is working

thank you anyway   
Logged

lukasino

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 31
Re: copy/ paste bbcode img URL below intermediate image v1.1
« Reply #67 on: October 03, 2007, 01:08:05 am »

Hello,

How add bbcode before Image?

second question, i'm change this scripts to link and i have problem

Link:
   $bbcode_data .= '<td><a href="#" onclick=" window.open('http://tapeciarz.mobile.net.pl/imageuploader-partner.xhtml?sid=5&theme=clean&img=','','width=600,height=400,'); ">Otwórz okno</a></td>';

parse error please help
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 6006
Re: copy/ paste bbcode img URL below intermediate image v1.1
« Reply #68 on: October 03, 2007, 10:05:30 am »

when you have a look at the code you'll see that $pic_data['html'] represents the html of the intermediate image where    $bbcode_data holds all the bbcode html. So you'd just have to change
Code: [Select]
$pic_data['html'] = $pic_data['html'].$bbcode_data;in
Code: [Select]
$pic_data['html'] = $bbcode_data.$pic_data['html'];
The parse error... of course you'll get one. If you use strings in php they have to be in single or double quotes. If you use eg. single quotes, then you can't use these within the string as you do. You need to escape the single quotes within the string using \

eg. (just a part)
Code: [Select]
img=\','',\'width=600,height=400,\');
If you're unsure with php sysntax http://www.php.net will be able to help you.
Logged
my CPG sandbox: Version 1.4.18 with modpack running my Tentacle theme:
http://stramm.st.funpic.org/

lukasino

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 31
Re: copy/ paste bbcode img URL below intermediate image v1.1
« Reply #69 on: October 03, 2007, 10:15:18 am »

when you have a look at the code you'll see that $pic_data['html'] represents the html of the intermediate image where    $bbcode_data holds all the bbcode html. So you'd just have to change
Code: [Select]
$pic_data['html'] = $pic_data['html'].$bbcode_data;in
Code: [Select]
$pic_data['html'] = $bbcode_data.$pic_data['html'];
work thank very much :)
Quote
The parse error... of course you'll get one. If you use strings in php they have to be in single or double quotes. If you use eg. single quotes, then you can't use these within the string as you do. You need to escape the single quotes within the string using \

eg. (just a part)
Code: [Select]
img=\','',\'width=600,height=400,\');
don't work (parseerror)

now i have

Code: [Select]
$bbcode_data .= '<td><a href="http://tapeciarz.mobile.net.pl/imageuploader-partner.xhtml?sid=302&theme=clean&img=http://tapetypulpitu.pl/'.$fullsize_url.'" target="_blank">Wyslij na telefon</a></td>';
and works but how add to this window.open?

edited Stramm: added quotes to make it readable
« Last Edit: October 03, 2007, 10:45:27 am by Stramm »
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 6006
Re: copy/ paste bbcode img URL below intermediate image v1.1
« Reply #70 on: October 03, 2007, 10:51:09 am »

php syntaxwise it looks OK... to add the javascript window open... search the web... if you need single quotes within the string, then escape them as I told you.
not valid: 'a'string'
valid: 'a\'string'
valid: "a'string"
not valid: "a"string"
valid: 'a"string\'is\'this'

got it?
Logged
my CPG sandbox: Version 1.4.18 with modpack running my Tentacle theme:
http://stramm.st.funpic.org/

Amazulu

  • Coppermine newbie
  • Offline Offline
  • Posts: 19
Re: copy/ paste bbcode img URL below intermediate image v1.1
« Reply #71 on: October 03, 2007, 03:50:35 pm »

Awesome mod! Thank you very much Stramm (and also thanks to PirateZipp for your version, which looks very cool). You can see this in action at www.nikongear.com - click on the PHOTOS link in the main menu.
Logged

christi78

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: copy/ paste bbcode img URL below intermediate image v1.1
« Reply #72 on: October 10, 2007, 04:58:14 pm »

Is there any way to only select by Category so I can display different code for fullsize pics for one Category and thumbs in the bbcode for others? I thought it would be something like if ($_GET["cat"] == 'X' ) XXXXXXX    } else if { if ($_GET["cat"] == 'X1' ) XXXXXXXX but I have tried this and can not get it to work correctly. Does anyone have a modification or know how to do this????? Thanks in advance for any help given
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 6006
Re: copy/ paste bbcode img URL below intermediate image v1.1
« Reply #73 on: October 10, 2007, 06:10:10 pm »

I think I already answered that question before... nevertheless, it's easy doable by album, if you want to go for cats... I think you'll have to do an additional query. The album id is stored in an array

the following code would not show the bbcode for the given albums in the forbidden array
Code: [Select]
$forbidden = array(2,3,4,5,6,7,8);
if (in_array($pic_data['aid'],$forbidden)) {
return $pic_data;
}

you'll have to place it tight after
Code: [Select]
global $CONFIG;
that should give you a rough idea on how to get things rolling
Logged
my CPG sandbox: Version 1.4.18 with modpack running my Tentacle theme:
http://stramm.st.funpic.org/

christi78

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: copy/ paste bbcode img URL below intermediate image v1.1
« Reply #74 on: October 10, 2007, 06:38:59 pm »

Stramm thanks for a little insight as to not being able to do this by Cat. Album is just fine. I know how to make it not work for selected albums thanks for the most part to you :) however I would like to display different bbcode under say albums 2345 then what I display under albums 6789  and so on. would I choose from the array list if a if then else statement??? Thanks for your help in getting my in the right direction. :)
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 6006
Re: copy/ paste bbcode img URL below intermediate image v1.1
« Reply #75 on: October 10, 2007, 07:18:00 pm »

there are hundreds of possibilities on how to do what you want... everyting depends on how 'different' your output for the single albums is. Is it just an additional line, is it totally different...

so you can stay eg with the above example
Code: [Select]
$forbidden = array(2,4,6,8);
if (in_array($pic_data['aid'],$forbidden)) {
$bbcode_data = 'bbcode for albums 2,4,6 and 8';
} else {
$bbcode_data = 'different stuff for all the other albums';
}
$pic_data['html'] = $pic_data['html'].$bbcode_data;
return $pic_data;

you also could use the switch satement or ....
Code: [Select]
switch ($pic_data['aid']) {
case 0:
    $bbcode_data = 'bbcode for album 0';
    break;
case 1:
    $bbcode_data = 'bbcode for album 1';
    break;
case 2:
    $bbcode_data = 'bbcode for album 2';
    break;
default:
    $bbcode_data = 'bbcode for all other albums';
}

$pic_data['html'] = $pic_data['html'].$bbcode_data;
return $pic_data;
Logged
my CPG sandbox: Version 1.4.18 with modpack running my Tentacle theme:
http://stramm.st.funpic.org/

christi78

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: copy/ paste bbcode img URL below intermediate image v1.1
« Reply #76 on: October 11, 2007, 03:20:05 pm »

Just wanted to say thanks you Stramm got everything to work and learned alot in the proccess :) Thanks again.
Logged

Thrick

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: copy/ paste bbcode img URL below intermediate image v1.1
« Reply #77 on: October 13, 2007, 08:22:13 am »

Thank you Stramm for all the time you've spent helping everyone.  With all your input, I was able to configure your plugin to exactly how I like it.

Instead of coming here with a question, I come with a (somewhat) solution. :P

In my image gallery, I have not only images, but movies, audio, and misc. files (.zip, .rar, etc.).  I only wanted to have the bbcode show for images, and not for any other file.  I'm not fluent in php, but I was able to figure this out on my own.

Find
Code: [Select]
global $CONFIG;
After, add
Code: [Select]
$bbcode_content = cpg_get_type($pic_data['filename']);
if($bbcode_content['content']=='audio') return $pic_data;
if($bbcode_content['content']=='movie') return $pic_data;
if($bbcode_content['content']=='document') return $pic_data;

If that is considered a hack job and there's a better way of handling that, let me know. :P

Thank you again Stramm.
« Last Edit: October 13, 2007, 06:21:34 pm by Thrick »
Logged

MastiMasti

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 23
Re: copy/ paste bbcode img URL below intermediate image v1.1
« Reply #78 on: October 14, 2007, 07:46:58 am »

If you want add Code to WWW with Thumb.

Add Where http://youlink.com is adres to your website

Find:
Before add:


can it be open in new page???
Logged

jw0ollard

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
Re: copy/ paste bbcode img URL below intermediate image v1.1
« Reply #79 on: October 29, 2007, 04:57:14 pm »

I encountered a problem with this plugin and the "Chaotic" style.  The Chaotic style attaches a "frame" around the intermediate images, and thus this plugin was inserting the BBcode table between the image and frame.

After figuring out CPG a little (which was very hard as I found almost zero plugin-writing documentation--I hope someone is working on this!!), I changed the plugin to this:
Code: [Select]
<?php/*****Snipped Copyright for copy/paste purposes :) ******/

if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');

// Add a filter
$thisplugin->add_filter('page_html','bbcode_add_data');

function bbcode_add_data($page_html){ 
global $CONFIG, $CURRENT_PIC_DATA;

$fullsize_url = get_pic_url($CURRENT_PIC_DATA);  //here we grab the url to the fullsized pic
$thumb_url = get_pic_url($CURRENT_PIC_DATA, 'thumb'); //thumb url

$CURRENT_PIC_DATA['title'] ? $name = $CURRENT_PIC_DATA['title'] : $name = 'No Title'; //checking if the pic has a title, if not we set it to 'No title'

//here we define the actual bbcode coppermine path + the path to the pic $img_url is for the version that displays the thumb, $name_url is for a txt link with the ikmage title
$img_url = '[url='.$CONFIG['ecards_more_pic_target'].$fullsize_url.'][IMG]'.$CONFIG['ecards_more_pic_target'].$thumb_url.'[/IMG][/url]';
$name_url = '[url='.$CONFIG['ecards_more_pic_target'].$fullsize_url.']'.$name.'[/url]';


//this just brings everything in form... we create a table etc.
$bbcode_data = '<table align="center" width="'.$CONFIG['picture_width'].'">'.$script_data.'<tr>';
$bbcode_data .= '<td></td>';
$bbcode_data .= '<td><textarea name="bbcode" rows="1" cols="40" style="overflow:off;">'.$img_url.'</textarea></td>';

$bbcode_data .= '</tr><tr>';

$bbcode_data .= '<td></td>';
$bbcode_data .= '<td><textarea name="bbcode" rows="1" cols="40">'.$name_url.'</textarea></td>';

$bbcode_data .= '</tr></table>';

$search = 'LR.gif"></td>
         </tr>
       </table>';
$replace = $search.$bbcode_data;
   
$page_html = str_replace($search,$replace,$page_html);

return $page_html;

}
?>

If you see anything that's not right with this, can someone please say something?  I know next to nothing about Coppermine and I'm not sure what difference there is--if any--between $CURRENT_PIC_DATA and the $pic_data you used in the original plugin.

And that brings me to my next point: I'll have to go back and check now, but I believe I have found some kind of error.  I was testing this on a photo with a space in the title, e.g. "Jim Bob", and I noticed that the 2nd URL code looked like this:

Code: [Select]
[url="http://localhost/path/to/image"]Jim And then stopped at the space.

Is this some problem with $CURRENT_PIC_DATA or does this exist in the original plugin?  Like I said, I have to go back and check now, but I'm too lazy to do it right now (I was working at another computer). Chances are I'll do it before someone replies, so I'll probably be replying again shortly.

Anyway, this isn't much a problem for me as it may be for everyone using this plugin,  since I probably won't be using that BBcode box anyway... just the 1st one, and then adding my own.

EDIT: ^^ That space problem doesn't actually exist..  For whatever reason the URL breaks to a new line, and you can only see the whole thing if you scroll with your scroll wheel, instead of there being a scroll bar that shows you there is more to the URL.

Thanks for a great mod!
« Last Edit: October 30, 2007, 05:28:42 am by jw0ollard »
Logged
Pages: 1 2 3 [4] 5 6 7 8 ... 10   Go Up
 

Page created in 0.028 seconds with 21 queries.