Images Display, But do not Change Even When Different Values are Entered. Images Display, But do not Change Even When Different Values are Entered.
 

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

Images Display, But do not Change Even When Different Values are Entered.

Started by Anime-Addict, January 14, 2008, 05:04:37 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Anime-Addict

About Me & My Setup:

Okay so now down to the nitty gritty.  My problems are as follows, listed in decreasing priority, with the most important at the top of the list.

  • cpgfetch displays images, yet they do not change upon sucessive pageviews or refreshes.  Even more disturbing is that the images do not change even when the
$objCpm->cpm_viewRandomMediaFrom("album=129", $options);
    album value is changed.[/li]
  • When inserting cpmfetch into a blog post it somehow breaks the theme, causing everything below cpmfetch to not display.

For the first issue:  If you follow the link http://www.ecchi-haven.net/wordpress_experiment/cpmfetch.php you get the quick and dirty php page I set up to test what I was doing outside of the wordpress environment.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?php
  
include_once "../coppermine/cpmfetch/cpmfetch.php";
  
$objCpm = new cpm("../coppermine/cpmfetch/cpmfetch_config.php");
  
$options = array("subtitle" => "Views: {{pHits}}");
  
$objCpm->cpm_viewLastAddedMedia(14$options);
  
$objCpm->cpm_viewRandomMediaFrom("album=130"$options);
  
$objCpm->cpm_close(); 
?>

</body>
</html>


Yet if you look at the example that breaks my wordpress theme http://www.ecchi-haven.net/wordpress_experiment/  You will see the same identical images, yet from the code below, the album referenced is #129, not #130.  The "exec" tags are the containers for the inline PHP plugin.


[exec]
include_once "../coppermine/cpmfetch/cpmfetch.php";
  $objCpm = new cpm("../coppermine/cpmfetch/cpmfetch_config.php");
  $options = array("subtitle" => "Views: {{pHits}}");
  $objCpm->cpm_viewLastAddedMedia(1, 4, $options);
  $objCpm->cpm_viewRandomMediaFrom("album=130", $options);
  $objCpm->cpm_close();
[/exec]



Anime-Addict

OOOkay, well This is a lesson learned in reverse engineering.  As you can tell from the "Page In Question" I fixed the problem.  What wast it?  Well look at my old block of code:


  include_once "../coppermine/cpmfetch/cpmfetch.php";
  $objCpm = new cpm("../coppermine/cpmfetch/cpmfetch_config.php");
  $options = array("subtitle" => "<font style:"font-size: 8pt;"><b>Views:</b> {{pHits}}</font>");
  $objCpm->cpm_viewLastAddedMedia(1, 4, $options);
  $objCpm->cpm_viewRandomMediaFrom("album=129", $options);
  $objCpm->cpm_close();


Line 4&5 is where the problem is, I believe that they are complimentary instructions.  First it wants last added media.  Okay easy enough I suppose.  But wait!  Line 5 refines the parameters further!  Now within the last added media, cpmfetch must select the ones only from album#129.  Well That cannot happen since the last added media was album 130!  Or something.  Anyhow the resultant code that actually works is this:

  include_once "../coppermine/cpmfetch/cpmfetch.php";
  $objCpm = new cpm("../coppermine/cpmfetch/cpmfetch_config.php");
  $options = array("subtitle" => "Views: {{pHits}}");
  $objCpm->cpm_viewRandomMediaFrom("album=129", 1, 3, $options);
  $objCpm->cpm_close();