copy/ paste bbcode img URL below intermediate image - Page 7 copy/ paste bbcode img URL below intermediate image - Page 7
 

News:

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

Main Menu

copy/ paste bbcode img URL below intermediate image

Started by Stramm, September 16, 2006, 07:16:10 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

bugattibuilder

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)

phill104

Quote from: bugattibuilder on July 06, 2008, 08:08:59 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

$thumb_url = get_pic_url($pic_data, 'thumb'); //thumb url

to this

$thumb_url = get_pic_url($pic_data, 'normal'); //normal url

For smaller images the smaller image will still work as an intermediate.
It is a mistake to think you can solve any major problems just with potatoes.

bugattibuilder

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](https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.domain.com%2Fphoto%2Falbums%2Fuserpics%2F10003%2F1384%2F%255Bb%255Dnormal_picture240px.jpg%255B%2Fb%255D&hash=0c954aa63da6b0b16dca25c986a31669ae09243a)[/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](https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.domain.com%2Fphoto%2Falbums%2Fuserpics%2F10003%2F1384%2F%255Bb%255Dpicture240px.jpg%255B%2Fb%255D&hash=07e93e65e1e96970f416ccc9e3a881bda6bd61d6)[/url


Stramm

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
$normal_url = get_pic_url($pic_data, 'normal'); //normal url
if (file_exists($normal_url)) {
//do something
} else {
//doesn't exist, do something else
}


bugattibuilder

I am going to try. It is my first attempt at PHP, so could take a while, I will post my results.

Stramm

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


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

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

Jacob2122002

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?

Nibbler

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

Jacob2122002

Quote from: Nibbler on July 11, 2008, 06:04:24 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

Nibbler

Caused by this:

<table align="center" width="9999">

I don't know where that came from; it's not a part of the plugin.

Jacob2122002

Quote from: Nibbler on July 11, 2008, 08:44:22 PM
Caused by this:

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

Nibbler

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

Jacob2122002

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

Nibbler

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.

Jacob2122002

Quote from: Nibbler 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.


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

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

mooxe

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

uglycars

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

Sorry, I'm a newb.


Stramm

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

mc0676

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 ?