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 ... 3 4 5 6 [7] 8 9 10   Go Down

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

0 Members and 1 Guest are viewing this topic.

bugattibuilder

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Re: copy/ paste bbcode img URL below intermediate image v1.1
« Reply #120 on: July 06, 2008, 08:08:59 pm »

I am using this mod for some time now, and I really like it.

However, would it be possible to alter the code in such a way, that it behaves like this:

-pressing the copy button will generate the code for displaying the intermediate image, linking to the large image. (simple till so far) BUT...

-when the larger image is smaller than the intermediate would be (normally 400 pixels), there is no intermediate. Instead of generating code for the intermediate, generate the code for the original picture. (which could link to itself, or no link at all)


Optionally, this could be split in 2 different "code" buttons, but users could then mess up the forum layout, by accidentally posting 2048 pixel wide pictures... i like to prevent that. (for which I did not succeed yet, I have trouble generating the neccesary code for the "original" option)
Logged

Phill Luckhurst

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4453
    • Windsurf.me
Re: copy/ paste bbcode img URL below intermediate image v1.1
« Reply #121 on: July 06, 2008, 08:54:13 pm »


-pressing the copy button will generate the code for displaying the intermediate image, linking to the large image. (simple till so far)

Change this line from this

Code: [Select]
$thumb_url = get_pic_url($pic_data, 'thumb'); //thumb url
to this

Code: [Select]
$thumb_url = get_pic_url($pic_data, 'normal'); //normal url
For smaller images the smaller image will still work as an intermediate.
Logged
It is a mistake to think you can solve any major problems just with potatoes.

bugattibuilder

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Re: copy/ paste bbcode img URL below intermediate image v1.1
« Reply #122 on: July 07, 2008, 08:23:00 am »

Tested this with a 240x240 px picture, but this generates a red cross (empty placeholder) for the picture.

The code generated is: (I crippled the url tags

url=http://www.domain.com/photo/albums/userpics/10003/1384/picture240px.jpg](http://www.domain.com/photo/albums/userpics/10003/1384/[b]normal_picture240px.jpg[/b])[/url

Which is OK for pictures over 400 px (my intermediate size). However, for smaller pictures it should read:

url=http://www.domain.com/photo/albums/userpics/10003/1384/picture240px.jpg](http://www.domain.com/photo/albums/userpics/10003/1384/[b]picture240px.jpg[/b])[/url

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 #123 on: July 07, 2008, 08:40:37 am »

two possibilities...
1. you do all the checks as in function theme_html_picture(). As result you know whether to use the fullsized or not.
2. you just check if a normal_ file exists. If yes, do what you intend to do, if not, do something else

http://php.net/manual/de/function.file-exists.php
Code: [Select]
$normal_url = get_pic_url($pic_data, 'normal'); //normal url
if (file_exists($normal_url)) {
//do something
} else {
//doesn't exist, do something else
}

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

bugattibuilder

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Re: copy/ paste bbcode img URL below intermediate image v1.1
« Reply #124 on: July 07, 2008, 10:04:21 am »

I am going to try. It is my first attempt at PHP, so could take a while, I will post my results.
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 #125 on: July 07, 2008, 10:32:27 am »

on a second thought... using URLs with file_exists may not necessarily work in all environments as expected. So it's better to use the server path

Code: [Select]
this is the path to the fullsized
$CONFIG['fullpath'].$pic_data['filepath'].$pic_data['filename']

and the intermediate
$CONFIG['fullpath'].$pic_data['filepath'].$CONFIG['normal_pfx'].$pic_data['filename']
us it eg. like
Code: [Select]
//does the normal file exist??
if (file_exists($CONFIG['fullpath'].$pic_data['filepath'].$CONFIG['normal_pfx'].$pic_data['filename'])) {
//do something eg. display bbcode for the intermediate image
$fullsize_url = get_pic_url($pic_data, 'normal');
} else {
//intermediate doesn't exist, do something else eg. print bbcode for fullsized image
$fullsize_url = get_pic_url($pic_data);
}

if you replace in codebase.php
Code: [Select]
$fullsize_url = get_pic_url($pic_data);  //here we grab the url to the fullsized pic
with the above, then the plugin prints the intermediate URL if that file exists, otherwise the fullsized... haven't tested it
Logged
my CPG sandbox: Version 1.4.18 with modpack running my Tentacle theme:
http://stramm.st.funpic.org/

Jacob2122002

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: copy/ paste bbcode img URL below intermediate image v1.1
« Reply #126 on: July 11, 2008, 04:37:47 pm »

Works great but whenever I look at a picture it stretches the page all the way across my screen? So I have to scroll to the right all the way until I see the picture.

Is that because of my screen resolution or is there a way to fix it?
Logged

Nibbler

  • Guest
Re: copy/ paste bbcode img URL below intermediate image v1.1
« Reply #127 on: July 11, 2008, 06:04:24 pm »

Post a link. Make sure you don't have debug mode enabled.
Logged

Jacob2122002

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: copy/ paste bbcode img URL below intermediate image v1.1
« Reply #128 on: July 11, 2008, 08:41:04 pm »

Post a link. Make sure you don't have debug mode enabled.


Nope, debug mode isn't on.

(its just a personal photo album)

http://jacobs-space.com/copperminenew/index.php
Logged

Nibbler

  • Guest
Re: copy/ paste bbcode img URL below intermediate image v1.1
« Reply #129 on: July 11, 2008, 08:44:22 pm »

Caused by this:

Code: [Select]
<table align="center" width="9999">
I don't know where that came from; it's not a part of the plugin.
Logged

Jacob2122002

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: copy/ paste bbcode img URL below intermediate image v1.1
« Reply #130 on: July 11, 2008, 08:53:48 pm »

Caused by this:

Code: [Select]
<table align="center" width="9999">
I don't know where that came from; it's not a part of the plugin.


I'm kinda new at this stuff....how would I take that out lol? And would I take out that whole line of code or just the width part?
Logged

Nibbler

  • Guest
Re: copy/ paste bbcode img URL below intermediate image v1.1
« Reply #131 on: July 11, 2008, 10:12:50 pm »

The whole line. First though, update your gallery to latest. 1.4.18. Then check in the plugin's codebase.php for that line.
Logged

Jacob2122002

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: copy/ paste bbcode img URL below intermediate image v1.1
« Reply #132 on: July 12, 2008, 03:14:32 am »

Code: [Select]
//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>[url][img][/url]</td>';

That is the lines I see. But there's not 9999 it just says "$CONFIG" ?
Logged

Nibbler

  • Guest
Re: copy/ paste bbcode img URL below intermediate image v1.1
« Reply #133 on: July 12, 2008, 12:58:12 pm »

That would indicate you have set 'Max width or height of an intermediate picture/video' to 9999 in config. Set it to something sensible instead.
Logged

Jacob2122002

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: copy/ paste bbcode img URL below intermediate image v1.1
« Reply #134 on: July 13, 2008, 11:38:51 am »

That would indicate you have set 'Max width or height of an intermediate picture/video' to 9999 in config. Set it to something sensible instead.


Thank you so much  ;D It's working now. I would of never though haha

Thank you again for the help  :D :D :D
Logged

mooxe

  • Coppermine newbie
  • Offline Offline
  • Posts: 10
Re: copy/ paste bbcode img URL below intermediate image v1.1
« Reply #135 on: August 05, 2008, 05:20:50 am »

Hi Guys,

A couple questions...

I am trying to place the code after the image title & description. I can place it above or below the image, thats all I can figure out though.

Am also trying to change the textarea to be one line vice however many it takes the URL to fit in a 40col wide area, without expanding the columns. I managed to do it on my other site but cant figure out the coppermine code. So for example, when a user clicks the text he simply scrolls left or right not up and down.

MOOXE
Logged

uglycars

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 45
Re: copy/ paste bbcode img URL below intermediate image v1.1
« Reply #136 on: September 13, 2008, 06:26:37 pm »

how do I enable hotlinking to get this plugin to work?

Sorry, I'm a newb.
Logged

uglycars

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 45
Re: copy/ paste bbcode img URL below intermediate image v1.1
« Reply #137 on: September 16, 2008, 05:37:03 am »

anyone??!!
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 #138 on: September 16, 2008, 07:26:05 am »

That's a question related to your server setup. No one here even knows what OS you're running so it's hard to give you advice. Usually you ask your webhost for questions related to your server. Hotlinking on *nix systems can be setup in a htaccess file or in the apache config file (if you're using the apache webserver - httpd.conf).
Logged
my CPG sandbox: Version 1.4.18 with modpack running my Tentacle theme:
http://stramm.st.funpic.org/

mc0676

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 44
Re: copy/ paste bbcode img URL below intermediate image v1.1
« Reply #139 on: October 01, 2008, 10:11:20 am »

He Stramm, i've a problem with your plugin.
How u can see here:
http://www.vwgolfcommunity.com/cpg/displayimage.php?album=311&pos=2

The code are not central with the image.

What do u think i need to do to solve this problem ?
Logged
Pages: 1 ... 3 4 5 6 [7] 8 9 10   Go Up
 

Page created in 0.021 seconds with 20 queries.