Advanced search  

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

Pages: [1] 2   Go Down

Author Topic: Paypal shop hack: img src="" for empty album, where is nopic.jpg?  (Read 22549 times)

0 Members and 1 Guest are viewing this topic.

sharpo

  • Coppermine frequent poster
  • ***
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 332

Just noticed the "nopic" thumbnail image does not show when I create a new album, but if I upload an image (or images) into the album then one of those will appear as the thumbnail.

At the moment I am setting up a new gallery using 1.4.3 with "full size access" & "paypal shop hack" mods added. The only other alterations are a new theme based on classic with just adjustments to colours used - nothing too serious.

I have searched and found the following to be a known fault - "No album thumbnails for albums that contain only pics linked by keyword" as I had already attempted creating an album for linked pics and noticed there was no thumbnail image, but has that had a knock on effect with other new albums I create?

I have done a "view source" on a 1.4.2 gallery that does work and the same for a 1.4.3 gallery that doesn't

This is the one that works:-

<!-- Start standard table -->
<table align="center" width="100%" cellspacing="1" cellpadding="0" class="maintable">

        <tr class="tableb_compact">

        <td width="17%" valign="top">
        <table width="100%" cellspacing="0" cellpadding="0">
        <tr>
                <td colspan="3" height="1" valign="top" class="tableh2">
                        <span class="alblink"><a href="thumbnails.php?album=114"><b>nopictest</b></a></span>
                </td>
        </tr>
        <tr>
                <td colspan="3">
                        <img src="images/spacer.gif" width="1" height="1" border="0" alt="" /><br />
                </td>
        </tr>
        <tr>
                <td align="center" valign="middle" class="thumbnails">
                        <img src="images/spacer.gif" width="102" height="1" class="image" style="margin-top: 0px; margin-bottom: 0px; border: none;" alt="" /><br />
                        <a href="thumbnails.php?album=114" class="albums"><img src="images/thumb_nopic.jpg" width="100" height="75" class="image" border="0" alt="" /><br /></a>
                </td>


---------------------------------------------------------------------------------------------------------------


This is the one with the missing nopic.jpg:-

<!-- Start standard table -->
<table align="center" width="100%" cellspacing="1" cellpadding="0" class="maintable">

        <tr class="tableb_compact">

        <td width="25%" valign="top">
        <table width="100%" cellspacing="0" cellpadding="0">
        <tr>
                <td colspan="3" height="1" align="left" valign="top" class="tableh2">
                        <span class="alblink"><a href="thumbnails.php?album=6"><b>test3</b></a></span>
                </td>
        </tr>
        <tr>
                <td colspan="3">
                        <img src="images/spacer.gif" width="1" height="1" border="0" alt="" /><br />
                </td>
        </tr>
        <tr>
                <td align="center" valign="middle" class="thumbnails">
                        <img src="images/spacer.gif" width="102" height="1" class="image" style="margin-top: 0px; margin-bottom: 0px; border: none;" alt="" /><br />
                        <a href="thumbnails.php?album=6" class="albums"><img src="" width="0" height="0" class="image" border="0" alt="" /><br /></a>
                </td>

Hope I have explained it clearly. I can see where the problem is, but not what is causing it.

Thanks for any help you can offer.
« Last Edit: January 27, 2006, 01:37:09 am by Paver »
Logged
Sharpo (not an expert, just a Coppermine user)
3 live galleries, first started in 2006.
http://www.sharpos-world.co.uk/BB3cpg/ with over 8,000 images.
http://www.sharpos-world.co.uk/cpg/ with over 25,000 images. 1.6.25
http://www.sharpos-world.co.uk/kc/ with over 300 images. 1.6.25

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: img src="" for empty album, where is nopic.jpg?
« Reply #1 on: January 26, 2006, 08:35:27 am »

Hey!  My Coppermine is doing that too!  I didn't know it wasn't supposed to do that.  That's pretty funny.

In my case, I figured out the issue.  I have a possibly strange thumb prefix; it's "thumbs/thumb_" so each album folder has a folder called thumbs where I have all my thumbs & intermediate images.  I don't remember if this setting worked out of the box or if I modified something.

So I had to create a thumbs folder in the images folder and copy the thumb_ images (including thumb_nopic.jpg) to this images/thumbs folder.  Then the nopic image showed up fine and I didn't have the img src="" anymore.

My guess for your case (unless you happen to have the exact same folder feature in your prefix) is that you changed the thumb prefix to something else and there's possibly a bug in the Coppermine code in that it uses your custom thumb prefix to try to find the images/thumb_ images and of course they are all named with the default prefix of thumb_.

If you do have a custom thumb prefix, please try to rename or copy thumb_nopic.jpg to YOURTHUMBPREFIX_nopic.jpg and see if that works.  If it does, please post here so I can look into this possible bug.

If you have the default thumb prefix, also let me know and we can postulate another possible cause.  As I said, my img src="" is now fixed (with a band-aid to be sure).
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: img src="" for empty album, where is nopic.jpg?
« Reply #2 on: January 26, 2006, 09:08:25 am »

@Paver: is this a bug or at least something that should be noted in the docs? If yes, please move this thread to the bugs board.
Logged

sharpo

  • Coppermine frequent poster
  • ***
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 332
Re: img src="" for empty album, where is nopic.jpg?
« Reply #3 on: January 26, 2006, 09:19:16 am »

Hey!  My Coppermine is doing that too!  I didn't know it wasn't supposed to do that.  That's pretty funny.

Is this a minor problem with all versions of 1.4.3 then?

I had previously looked in the images folder and noticed that the files such as nopic.jpg & txt.jpg did not have thumb_ preceding the name, but thought there may have been reasons for this, so did not take any notice. Since reading your message, I have changed nopic.jpg to thumb_nopic.jpg & it works fine.

My 1.4.3 was downloaded from this site, so should have been a "proper" version.


Logged
Sharpo (not an expert, just a Coppermine user)
3 live galleries, first started in 2006.
http://www.sharpos-world.co.uk/BB3cpg/ with over 8,000 images.
http://www.sharpos-world.co.uk/cpg/ with over 25,000 images. 1.6.25
http://www.sharpos-world.co.uk/kc/ with over 300 images. 1.6.25

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: img src="" for empty album, where is nopic.jpg?
« Reply #4 on: January 26, 2006, 09:25:28 am »

as I suggested in my previous posting: we're trying to determine if this is a bug. Please allow some time for Paver to reply.
Logged

sharpo

  • Coppermine frequent poster
  • ***
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 332
Re: img src="" for empty album, where is nopic.jpg?
« Reply #5 on: January 26, 2006, 09:38:00 am »

Sorry GauGau, I started my reply before your posting was added - I must be a slow writer.
Logged
Sharpo (not an expert, just a Coppermine user)
3 live galleries, first started in 2006.
http://www.sharpos-world.co.uk/BB3cpg/ with over 8,000 images.
http://www.sharpos-world.co.uk/cpg/ with over 25,000 images. 1.6.25
http://www.sharpos-world.co.uk/kc/ with over 300 images. 1.6.25

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: img src="" for empty album, where is nopic.jpg?
« Reply #6 on: January 26, 2006, 04:25:36 pm »

I didn't have time last night to investigate further.  I just tried the simple thing I noted and it worked.  I also wondered about the missing thumb_ at the beginning of nopic.jpg (based on something I saw in the code), but since mine said thumb_nopic.jpg, I didn't think about it (yet).

Once I look into this (soon), I'm sure it will be easy to classify & fix if necessary.
Logged

Blueiris

  • VIP
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Female
  • Posts: 170
  • Horse poor!
    • Saddlebred World Gallery
Re: img src="" for empty album, where is nopic.jpg?
« Reply #7 on: January 26, 2006, 06:59:16 pm »

I'm not comfortable that this is a bug, because my test install of cpg1.4.3. shows the thumb_nopic.jpg for an empty album just as it should, and that's basically an out-of-the-box install.

http://www.goldiris.com/Coppermine/

You can see two empty albums on the home page, and if you go to User galleries > Blueiris, there is a third. (It's OK to register and play with that install - it's a testbed)

The default thumb_nopic.jpg resides in the top level images folder, (not under themes or albums) so "images/thumb_nopic.jpg" in the code is correct.

Display can be controlled thru theme.php - see sample/theme.php - look for "// HTML template for the album list," then go down near line 280. It's also in theme.inc.php, so if that's been altered it might have an effect.

I'm not sure why this wasn't working for sharpo and Paver, but I know it's worked properly in my test installs on my PC and in my public gallery, too. We dont' need to get out the bug spray if there isn't a bug, but I'm sure we should figure out what is different between these installs.

Logged
You can lead a horse to water, but you can't make him drink - he's got to discover that it's wet for himself.

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: img src="" for empty album, where is nopic.jpg?
« Reply #8 on: January 26, 2006, 07:22:46 pm »

Right, I agree.  That's why I haven't moved it yet.  Thanks for your input.  I have a few suspicions and will dive into the code to figure out what's going on.  My setting of using a sub-folder for the thumb prefix may not be supported out of the box, so I don't presume to say this is a bug if it's just my wacko setting.  I will certainly figure out if nopic.jpg could have been renamed in the code - that's one of my suspicions.

I will post once I figure it out.
Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: img src="" for empty album, where is nopic.jpg?
« Reply #9 on: January 26, 2006, 07:58:17 pm »

A quick update.  (I have some chores to do so don't know if I'll finish the full investigation now.)

First of all, my sub-folder in the thumb prefix is not supported out of the box, so let's put that aside.

The main issue I see with a new install of 1.4.3 is this:
  • If you rename the thumb prefix (before you have any pictures so this is "legal"), the relevant pics in the core images folder get renamed to the new thumb prefix; i.e. if you use 'thumby_', then thumb_nopic.jpg is renamed to 'thumby_nopic.jpg'.  Everything works fine.
  • If you change the thumb prefix to blank, the image/ files are renamed correctly to have no prefix. Everything is still working.
  • If you change the thumb prefix to something non-blank after having it blank, then the image/ files are not renamed to include the new prefix; they still have no prefix, and then you get the blank img src as this thread found.  I don't know if this was the exact issue that occurred in sharpo's case.

I suspect there might be an images/ rename for upgrade installations, but I haven't looked yet.

@sharpo: Is your installation a brand new one or an upgrade?  If an upgrade, from which version?  If a new one, did you change the thumb prefix at all?

I wouldn't consider this a bug yet.  Having someone do what I did is rather rare I would think, so I'm not sure if more common actions would cause the mis-rename.  I do think that Coppermine shouldn't produce a blank img src even if no images can be found (for whatever reason), so I might consider this an issue and want to fix it still, but I'll decide this when the investigation is complete.  Others are welcome to join in, but I'm willing to do this myself as well.

Oh, I realize that having a blank thumb prefix doesn't make sense, so I don't consider making the thumb prefix blank and then non-blank a bug, according to the "rules" of having a thumb prefix.  It's an issue to consider for people who actually do that.
« Last Edit: January 26, 2006, 08:07:54 pm by Paver »
Logged

sharpo

  • Coppermine frequent poster
  • ***
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 332
Re: img src="" for empty album, where is nopic.jpg?
« Reply #10 on: January 26, 2006, 08:10:27 pm »

Just had the idea to check the files created when I unzipped the original download of 1.4.3 & that shows those files such as "nopic.jpg" all had thumb_ as a prefix. This means one of those mods/hacks mentioned in the original posting may have renamed the original files?

I can assure you that I haven't modified the names of any of those .jpg files. Hope this helps you solve this query.

I might have some other backups which might indicate at what point the file names were "changed", if I find them will post a message later


****Quick amendment, Paver posted while I was typing the above (proves I am a slow typist) and I will answer as follows:-
The installation was a brand new one.
I made no alterations to the thumb prefix.
Logged
Sharpo (not an expert, just a Coppermine user)
3 live galleries, first started in 2006.
http://www.sharpos-world.co.uk/BB3cpg/ with over 8,000 images.
http://www.sharpos-world.co.uk/cpg/ with over 25,000 images. 1.6.25
http://www.sharpos-world.co.uk/kc/ with over 300 images. 1.6.25

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: img src="" for empty album, where is nopic.jpg?
« Reply #11 on: January 26, 2006, 08:23:37 pm »

You mentioned 2 mods/hacks.  Is the full-size access mod you mention the plugin "Full-Size Photos Access Control"?  I wrote this plugin and it doesn't rename any files.  It just removes the full-size link on the displayimage page.

Please describe which mods you mean, in case it's related.
Logged

sharpo

  • Coppermine frequent poster
  • ***
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 332
Re: img src="" for empty album, where is nopic.jpg?
« Reply #12 on: January 26, 2006, 08:48:35 pm »

You mentioned 2 mods/hacks.  Is the full-size access mod you mention the plugin "Full-Size Photos Access Control"?  I wrote this plugin and it doesn't rename any files.  It just removes the full-size link on the displayimage page.

Please describe which mods you mean, in case it's related.

Yes, Paver, it is your plug-in, version 1.2 as in topic 25010
Logged
Sharpo (not an expert, just a Coppermine user)
3 live galleries, first started in 2006.
http://www.sharpos-world.co.uk/BB3cpg/ with over 8,000 images.
http://www.sharpos-world.co.uk/cpg/ with over 25,000 images. 1.6.25
http://www.sharpos-world.co.uk/kc/ with over 300 images. 1.6.25

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: img src="" for empty album, where is nopic.jpg?
« Reply #13 on: January 26, 2006, 08:52:43 pm »

And which Paypal shop hack?
Logged

sharpo

  • Coppermine frequent poster
  • ***
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 332
Re: img src="" for empty album, where is nopic.jpg?
« Reply #14 on: January 26, 2006, 09:01:33 pm »

And which Paypal shop hack?

Started with the Madeinhawaii one, topic 22357.40 then replaced it with the Casper version topic 26454
Logged
Sharpo (not an expert, just a Coppermine user)
3 live galleries, first started in 2006.
http://www.sharpos-world.co.uk/BB3cpg/ with over 8,000 images.
http://www.sharpos-world.co.uk/cpg/ with over 25,000 images. 1.6.25
http://www.sharpos-world.co.uk/kc/ with over 300 images. 1.6.25

sharpo

  • Coppermine frequent poster
  • ***
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 332
Re: img src="" for empty album, where is nopic.jpg?
« Reply #15 on: January 26, 2006, 10:37:27 pm »

Looks like I backed up my site on the 20th & "thumb_" was the prefix on such files as nopic.jpg

Soon after that I download Casper's paypal shop hack - topic 26454, and it must have been after that when "thumb_" prefix disappeared.

Hope that helps narrow it down a bit.
Logged
Sharpo (not an expert, just a Coppermine user)
3 live galleries, first started in 2006.
http://www.sharpos-world.co.uk/BB3cpg/ with over 8,000 images.
http://www.sharpos-world.co.uk/cpg/ with over 25,000 images. 1.6.25
http://www.sharpos-world.co.uk/kc/ with over 300 images. 1.6.25

Blueiris

  • VIP
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Female
  • Posts: 170
  • Horse poor!
    • Saddlebred World Gallery
Re: img src="" for empty album, where is nopic.jpg?
« Reply #16 on: January 26, 2006, 10:58:56 pm »

I *might* have found the cause, but since I don't claim a heavy expertise in PHP, I'm not 100% sure this is the culprit. It is in Casper's paypal hack, in the shop.php. At line 136, there is the following code:

Quote
        // Code to rename system thumbs in images folder
        $old_thumb_pfx =& $CONFIG['thumb_pfx'];

        if ($old_thumb_pfx != $_POST['thumb_pfx']) {
            $folders = array('images/', $THEME_DIR.'images/');
            foreach ($folders as $folder) {
                $thumbs = cpg_get_system_thumb_list($folder);
                foreach ($thumbs as $thumb) {
                    @rename($folder.$thumb['filename'],
                            $folder.str_replace($old_thumb_pfx,$_POST['thumb_pfx'],$thumb['filename']));
                }
            }
        }

This is the same code that is used in update.php to rename the thumbs in the top level images folder when updating Coppermine. Perhaps Paver or GauGau can clarify my thinking here, but it looks to me as through this code in shop.php is reading thumb_pfx from cpg143_config as the old thumb prefix, and replacing it in the filename with nothing.

I'll await a more expert opinion!

« Last Edit: January 26, 2006, 11:08:08 pm by Blueiris »
Logged
You can lead a horse to water, but you can't make him drink - he's got to discover that it's wet for himself.

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: img src="" for empty album, where is nopic.jpg?
« Reply #17 on: January 27, 2006, 12:39:46 am »

Blueiris: I'm sure you found it - good job.  That's saves me some time. 

First of all, everything I said above about producing the problem on my computer is moot for this particular thread.  Please ignore it.  (I will use the information for my own uses, but it's unrelated to sharpo's original problem.)

Second of all, Casper copied the code you mentioned from admin.php, not update.php.

So here's my guess.  Let's start at the beginning.  Coppermine apparently uses the thumb prefix everywhere, for all thumbs, including the system ones in the core images/ folder.  (Something I'm going to take up with the devs.)  So whenever you change the thumb prefix, it renames the images/thumbs to use the new thumb prefix.  It also renames the thumbs in the current theme/images as well, but only the current theme.  If you happen to change the thumb prefix and then change to a new theme that has its own images/thumbs, the thumbs won't have the correct prefix.  (I haven't reproduced this supposed error yet.)  The core themes actually don't have any custom thumbs, so this issue only occurs for other themes that have custom thumbs.  I only mention this for reference; it's not related I don't think to this issue, but it might be if Casper wanted to make sure the theme's custom thumbs are correct.  As I mention below, I have no idea besides this one why he bothers to rename the thumbs.

Casper's hack also renames the thumbs in the core/images and the theme/images, but it does this when you configure the Paypal shop, every time.  I'm not sure why.  The problem is that he uses the $_POST['thumb_pfx'] which is not defined by his form; it *is* defined by the config panel form (in admin.php), so when you change the thumb prefix, it will use the new setting you set (in $_POST['thumb_pfx']) to rename the thumbs as I said.

So, $_POST['thumb_pfx'] is blank and all the core thumbs are renamed to have no thumb prefix.  This is the problem that sharpo found.  It's a bug in the Paypal shop hack, but it does highlight an issue I think exists in the core code about renaming the thumbs.  I will discuss this information with the devs.

In the end, I think this thread belongs in the Mods board.  I'll modify the title to reflect the Paypal shop bug.   I don't think it's instructive to merge it with the Paypal shop thread, but I will post on that thread with a link to this thread.

But first:
@sharpo: Could you try to configure your Paypal shop and hit submit?  You don't have to change anything, just go to the config page, then submit.  My guess is that it will rename your core images/thumbs and you'll have the same blank img src that started this thread.  If so, please let me know, so I can close this issue as "Solved".  Of course, after you do this, just rename the thumbs again.   ;)
Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: img src="" for empty album, where is nopic.jpg?
« Reply #18 on: January 27, 2006, 12:47:27 am »

I think I figured out why Casper has this rename code in his shop.php.  At first, I couldn't figure out why if $lang_shop_data is not defined, he uses $lang_config_data since $lang_config_data is not present anywhere in the lang file.  Then I realized that what he really means is $lang_admin_php which is the new config form.  So if his config elements are not present, he reproduces the admin config panel and needs to process those form elements as they are in admin.php.  I assume $lang_config_data came from version 1.3's config.php.

In any case, if this really is the issue sharpo has, I'll bring it up on Casper's thread for him to decide what to do. 
Logged

sharpo

  • Coppermine frequent poster
  • ***
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 332
Re: img src="" for empty album, where is nopic.jpg?
« Reply #19 on: January 27, 2006, 01:09:23 am »

Blueiris: I'm sure you found it - good job.  That's saves me some time. 

@sharpo: Could you try to configure your Paypal shop and hit submit?  You don't have to change anything, just go to the config page, then submit.  My guess is that it will rename your core images/thumbs and you'll have the same blank img src that started this thread.  If so, please let me know, so I can close this issue as "Solved".  Of course, after you do this, just rename the thumbs again.   ;)

Did what you suggested, Paver, and sure enough - ended up with the blank img src

So as it stands at the moment, if I make any alterations to the Paypal shop I will have to add thumb_ to any of those images such as nopic.jpg that I might be using. Nothing too drastic really, as long as there is nothing else awaiting me "round the corner" so to speak.

Well spotted to Blueiris, as well.
Logged
Sharpo (not an expert, just a Coppermine user)
3 live galleries, first started in 2006.
http://www.sharpos-world.co.uk/BB3cpg/ with over 8,000 images.
http://www.sharpos-world.co.uk/cpg/ with over 25,000 images. 1.6.25
http://www.sharpos-world.co.uk/kc/ with over 300 images. 1.6.25
Pages: [1] 2   Go Up
 

Page created in 0.034 seconds with 20 queries.