How to get pic URL to galley view How to get pic URL to galley view
 

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

How to get pic URL to galley view

Started by Jared5755, May 15, 2009, 02:24:53 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Jared5755

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


Joachim Müller

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

Jared5755

Quote from: Joachim Müller on May 18, 2009, 08:24:53 PM
In which way is this related to plugins?

Because I'm working on making a plugin.

Quote from: Joachim Müller on May 18, 2009, 08:24:53 PM
Post what you actually want to accomplish.
I got it figured out.  I'll post some code for other people's reference.


Quote from: Joachim Müller on May 18, 2009, 08:24:53 PM
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.

Joachim Müller

Quote from: Jared5755 on May 19, 2009, 05:27:15 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:
Quote from: Joachim Müller on September 28, 2008, 10:27:07 AM8. 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
Quote from: Joachim Müller on September 28, 2008, 10:26:07 AM7. 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.

Quote from: Jared5755 on May 19, 2009, 05:27:15 AM
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.

Quote from: Jared5755 on May 19, 2009, 05:27:15 AM
I got it figured out.  I'll post some code for other people's reference.
Please go ahead.

Jared5755

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.

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

}

?>




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