Advanced search  

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]

Pages: [1]   Go Down

Author Topic: How to get pic URL to galley view  (Read 7882 times)

0 Members and 1 Guest are viewing this topic.

Jared5755

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
How to get pic URL to galley view
« on: May 15, 2009, 02:24:53 am »

I want to grab the link to the page that shows the pic, comments, filmstrip, etc.

I found this function that returns the url to the direct picture only.  How do I get the "gallery view" (not sure what you call it)...hope this makes sense.
Quote
/**
 * get_pic_url()
 *
 * Return the url for a picture
 *
 * @param array $pic_row
 * @param string $mode
 * @param boolean $system_pic
 * @return string
 **/

function& get_pic_url(&$pic_row, $mode,$system_pic = false)
{

Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: How to get pic URL to galley view
« Reply #1 on: May 18, 2009, 08:24:53 pm »

In which way is this related to plugins? Post what you actually want to accomplish. Read the board rules thread as well.
Logged

Jared5755

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Re: How to get pic URL to galley view
« Reply #2 on: May 19, 2009, 05:27:15 am »

In which way is this related to plugins?

Because I'm working on making a plugin.

Post what you actually want to accomplish.
I got it figured out.  I'll post some code for other people's reference.


Read the board rules thread as well.

Read every word of the thread rules and coppermine docs multiple times...but maybe I don't remember every word...sorry.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: How to get pic URL to galley view
« Reply #3 on: May 19, 2009, 09:16:26 am »

Read every word of the thread rules and coppermine docs multiple times...but maybe I don't remember every word...sorry.
OK, how about this one then:
8. Post links
When posting a support request, it's helpfull for supporters in most cases to see what the actual page looks like, that's why it's recommended that you always post a link to your coppermine gallery page when asking for support. If your site contains adult content, make sure to post a warning together with your link!
or
7. Be detailed
Post as many details as possible on the issue you're facing; for a start, you should post a link to your gallery and a test user account (without admin privileges). If the page in question can't be accessed by "regular" users (e.g. admin pages), post a screenshot.
[...]
Posting a link to your gallery is almost always mandatory.
Those two rules are pretty easy to memorize, don't you agree? And you have already been told many times over to read them, so you better read them each and every time before you start a new thread. Your next breach of board rules (even a minor one) will lead to a ban.

I'm working on making a plugin.
So you're a coder? Then you should know what questions can be asked and which ones are just invalid.

I got it figured out.  I'll post some code for other people's reference.
Please go ahead.
Logged

Jared5755

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Re: How to get pic URL to galley view
« Reply #4 on: May 20, 2009, 11:00:08 pm »

Ok, here's the code I came up with.  It's very likely there's a better way to do it, but as can be seen above there wasn't a whole lot of help.  Code below works though.  If you want to see it in action, just download the attached file and install as a plugin.

Code: [Select]
<?php
/**************************************************
  CPG Pluin for showing direct link under each image.
  There really isn't much point in installing this plugin
  since the same thing can be seen by clicking the info
  button.  This is more of a demo for other pugin
  programmers.
 *************************************************
  Copyright (c) 2009 MadScout <pm me on cpg forums for info>
  *************************************************
  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
  POD Plugin version: 1.0
  $Revision: 1.0 $
  $Author: MadScout $
***************************************************/


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

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


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

$address $_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"];

//prepare address by ripping out stuff we don't need
$address 'http://'.substr($address0strpos($address'?')+1).'pos=-'.$pic_data['pid'];

$link '<a href='.$address.'>'.$address.'</a>';

$pic_data['html'] = $pic_data['html'].$link

return $pic_data

}

?>



Quote
Those two rules are pretty easy to memorize, don't you agree? And you have already been told many times over to read them, so you better read them each and every time before you start a new thread. Your next breach of board rules (even a minor one) will lead to a ban.
First off, it's hard to post a link to the gallery when it's a local server only I have access to.  Why would I want to develop on a public server?  If my question really required access to my gallery to answer then I'd put it up.

Ban me if you want to, but c'mon man that's ridiculous.  I'm just trying to contribute to the community.




Logged
Pages: [1]   Go Up
 

Page created in 0.026 seconds with 21 queries.