#1 2003-12-19 10:07:57

Solo
Guest

Link A File To A Picture

Excuse me for this approximative english...

I would like to know how to link an archive to a picture like it's done in the template gallery.

thx

 

#2 2003-12-19 10:42:44

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13885

Re: Link A File To A Picture

For the link to a file under each template in the official gallery of the PhpWebGallery site, I used an external script : it reads the database for a given category and create an HTML comment for each picture in the category.

Anytime, I go to the URL http://.../update_links.php and all my file links (picture comments in fact) are updated in the database.

Offline

 

#3 2003-12-19 13:53:31

Solo
Guest

Re: Link A File To A Picture

Sorry, I didn't find the way to do what you explained... :(
So I open phpmyadmin and put some html code in the picture's comment. It works but it's a bit long.

thx

 

#4 2003-12-19 14:37:59

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13885

Re: Link A File To A Picture

put this file in your admin directory

Code:

<?php
/***************************************************************************
  *                            update_links.php                             *
  *                            -------------------                          *
  *   application   : PhpWebGallery 1.3                                     *
  *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
  *                                                                         *
  ***************************************************************************/

$base_url = 'http://www.phpwebgallery.net/download/templates';
define( PREFIX_INCLUDE, '.' );
include( '../include/functions.inc.php' );
database_connection();

$categories = array( 6 => 'default' );

foreach ( $categories as $cat_id => $dir ) {
  $query = 'SELECT id,file';
  $query.= ' FROM '.PREFIX_TABLE.'images';
  $query.= ' WHERE storage_category_id = '.$cat_id;
  $query.= ';';
  $result = mysql_query( $query );
  while ( $row = mysql_fetch_array( $result ) )
  {
    $filewoext = get_filename_wo_extension( $row['file'] );
    $comment = '<span style="font-size=16px;">';
    $comment.= '[ <a href="'.$base_url.'/'.$dir.'/'.$filewoext.'.zip"';
    $comment.= ' class="download">';
    $comment.= $filewoext.'.zip';
    $comment.= '</a> ]';
    $comment.= '</span>';

    $query = 'UPDATE '.PREFIX_TABLE.'images';
    $query.= " SET comment = '".$comment."'";
    $query.= ' WHERE id = '.$row['id'];
    $query.= ';';
    mysql_query( $query );
  }
}
?>

Offline

 

#5 2003-12-19 14:56:46

Solo
Guest

Re: Link A File To A Picture

Should I replace the base_url parameter by mine ?

 

#6 2003-12-19 15:08:59

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13885

Re: Link A File To A Picture

yes, and the category id to update also

Offline

 

#7 2003-12-19 16:04:10

Guest
Guest

Re: Link A File To A Picture

I'll try it and tell you.

thx

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2025 · Contact