Recent posts - Page 8 Recent posts - Page 8
 

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

Recent posts

#71
Mods: content syndication (cpmFetch) / cpmfetch updated to V2.2. Augu...
Last post by 406man - August 08, 2024, 04:08:19 PM
Recently I became aware of cpmfetch and thought it could be very useful to display images from the gallery that I run on a Wordpress site. My site uses CPG 1.6.26 and PHP 8.2.19. Unfortunately cpmfetch didn't run properly with this combination so I set about getting it working. Initial tests were successful and, as  I was impressed with what it could do, decided to fix the code where existing functionality didn't work properly, add new features and update the documentation. During the whole process I tried to maintain existing functionality but ran into lots of bugs which I've fixed. The code base used was release 2.0.1 which is the most recent "working" version. The original author Vuud released a development version 2.1.1 but this was incomplete so to avoid confusion I've numbered the new version 2.2.

There was a lot of interest in cpmfetch in the past so I'm submitting the updated code to this forum in the hope that other members will find it useful.

Thanks are due to a number of people who have updated cpmfetch in over the years since vuud moved on, particularly ron4mac who updated it to PHP 7 to make it compatible with CPG 1.6.x.  Thanks are also due to gmc who runs a copy of the cpmfetch documentation on his web site as the original site run by vuud is no longer active. Most of the documentation is still applicable but there have been a few changes and corrections. Gmc's site is here:
http://gallery.gmcdesign.com/cpmfetch/docs/basic/

While getting it working I found what for me was a major problem impacting categories when there is a hierarchy of categories. Whether it's a bug, feature or intended behaviour I don't know and will explain with an example.

Suppose you have a gallery for pictures of cities around the world and you have categories for the continent and country. The categories are  North America, South America, Europe
In the North America category are categories USA, Canada, Greenland.
Albums containing pictures are Los Angeles and Miami in the USA category, Toronto, Vancouver and Ottawa in the Canada category. Plus others.

You might want cpmfetch to choose a random picture from North America, expecting it to dig down to the Los Angeles, Miami, Toronto etc albums. But this wouldn't work and the set of pictures would be blank. As far as I can see from the code, this is because the code only drops down one level of categories to find albums. But the USA / Canada / Greenland categories below North America are two levels down in the hierarchy. It would only return some pictures if you picked the USA or Canada categories instead of North America. While this is workable it's more awkward than if cpmfetch worked by accessing every album in the hierarchy below a particular category. To fix this I've updated the category function so that it works down through the category hierarchy. In the example you just need to enter, for example, the category number for North America and all the city albums will be accessible.

The whole situation around owner has changed. Owner is another way of referring to the user who uploaded the image. The owner_name field was removed from the CPG database some time before version 1.6 so I've changed the code to use its replacement - owner id. This has meant a change to the $source parameter. By changing its name to ownerid rather than leaving it as owner it's clear that the meaning has changed.

I found it awkward to test the various functions of cpmfetch so created a couple of test programs. As this is a major area on its own I've created a separate forum topic. The first program is called testfetch.php. It's run in a web browser and displays the cpmfetch code and the pictures taken from Coppermine in the simplest possible way with no added CSS. The idea is that you can check and debug your cpmfetch calls in the test program and then, when you're happy, add them to your Wordpress site or whatever and finalise the formatting there. To run the test program use your web browser with a URL like this – tailored to suit your gallery:
https://yourgallery.com/whatever/cpmfetch/testfetch.php

The second test program creates a slideshow which cycles through a configurable number of images. A separate article describes the test programs in more detail.

A major feature I added is the use of separate files called Include files where the actual cpmfetch code goes. These are included into either the test program or web site when needed. They allow you to develop the cpmfetch setup using the test programs, then go to the web site to run them without making any changes once the initial setup is done. These are described in a separate article.

Here is an example of the cpmfetch code:
$options = array( 'imageheight' => '350', 'imagesize' => 'int' );
$objCpm-> cpm_viewRandomMediaFrom("album=256", 1, 3, $options);

In the above:
•   "album=256" is the $source parameter and is where cpmfetch searches for images. Note that only publicly visible images can be displayed
•   1 is the number of rows created
•   3 is the number of columns. Or number of images in the row if there's only one row.
•   $options is the $options array which is in the line above it

Some other examples of the main cpmfetch routine are below where I've changed the $source parameter. Only one of these is used at a time.
$objCpm-> cpm_viewRandomMediaFrom("cat=9:keyword=xyz", 1, 3, $options);
$objCpm-> cpm_viewRandomMediaFrom("ownerid=171",1, 3, $options);
$objCpm-> cpm_viewRandomMediaFrom("text=amsterdam",1, 3, $options);


High level documentation is provided in this forum thread.
Detailed documentation on the $options, $source and functions are provided in a .htm file in the cpmfetch main directory. Open this file in a web browser.

A separate article in this forum describes how to link Wordpress to a Coppermine gallery.

I hope other Coppermine users find this updated version useful. I've tried to maintain all the original functions although some changes have been required and I've also removed functions that were deprecated and duplicated other functions. It's inevitable in a complex program like cpmfetch that there will be some more bugs so if you find one that means you can't do what you want to, let me know in this forum by including:
- what you want to achieve
- a description of what happened
- the error message if you have one
- the cpmfetch code being used. Preferably attach the relevant include file to the forum topic.

-----------------------------------------------------
Major Bugs fixed

  • PHP 8.2 deprecation warnings
  • Option to use intermediate images failed if the image didn't exist. This is allowed by the rules of intermediate images if the full size image is smaller than the intermediate so I altered the code to use the full size image (Called large in cpmfetch terminology) if the intermediate doesn't exist
  • Fetching images using keyword search caused a crash.
  • getRandomSeed function generated error message
  • Some of the options to set CSS style name and properties didn't work properly
  • Replaced old problem.gif which was corrupted

New or substantially revised Features

  • Works with CPG 1.6.26 and PHP 8.2.19.
  • The actual cpm configuration commands optionally go in a separate file which is included into the test program or final website.
  • A large number of example Include files containing cpmfetch commands are provided which can be used as a base rather than having to type everything in
  • Slideshow runs and optionally displays a subtitle. Has a test program called testslideshow
  • As described above, a category search will find images in the hierarchy below that category, rather than just albums with that category as their parent.
  • Large images can be displayed in a separate screen by clicking on the fetched image using windowtarget= '_blank-js'
  • New functions cpm_viewMediaFromAlbum and cpm_viewMediaFromCategory allow fetching of images in a way that matches the sequence in the CPG gallery thumbnail display. The same 8 sorting choices are available

Installing cpmfetch
The installation procedure is unchanged. Unzip the contents of the distribution file and move the directory tree so that cpmfetch is inside the Coppermine gallery family of directories. A standard gallery will have directories name albums, bridge, css etc. The cpmfetch must be beside these directories at the same level. If it is put anywhere else, cpmfetch will not work. Once it is in the right place run the installation procedure from a web browser:
https://yourgallery.com/yourgallerypath/cpmfetch/install.php
Check the output to be confirm that it has worked correctly.

-------------------------------------
Background
Cpmfetch is an add-on set of programs for Coppermine created by user vuud around 2006 for CPG 1.3.x. It's a versatile PHP program used for pulling images out of the Coppermine system for display in other web applications. The forum post by vuud here gives a lot of information on it:
https://forum.coppermine-gallery.net/index.php/topic,35450.0.html
Sadly vuud is no longer active in the Coppermine world and cpmfetch has drifted in recent times.
#72
cpg1.6 language / Re: Japanese text now gibberis...
Last post by phil1011 - August 05, 2024, 02:34:36 PM
Thank you so much ron4mac! It worked!
#73
cpg1.6 language / Re: Japanese text now gibber...
Last post by ron4mac - August 05, 2024, 01:33:56 PM
Add this line:
$CONFIG['dbcharset'] = 'latin1';
to the bottom of your include/config.inc.php file.
#74
cpg1.6 language / Japanese text now gibberish af...
Last post by phil1011 - August 05, 2024, 08:40:45 AM
Hello,

I'm running version 1.6.07.

After my web host upgraded to MySQL 8.0 (from MySQL 5.7), my site's Japanese text has become gibberish.

How can I fix this?

My web host's support gave me this message:

"The issue you are running into is that the older versions of MySQL
used "latin1" character set and "latin1_swedish_ci" collation as the
server defaults. The new versions of MYSQL now use 'utf8mb4' character set
and usually "utf8mb4_0900_ai_ci" as the collation. Your content was encoded
under latin and swedish terms, but is now being served or read as if it was
utf8mb4 encoded.

We are not overly familiar with Coppermine Photo Gallery, but many
users that have seen similar issues with other software packages have been
able to correct their issues by setting their software to expect or use the
"latin1" character set, without making any changes to the database itself.
I am not certain if this is a setting available in Coppermine though."

Thanks for any advice.
#75
cpg1.6 miscellaneous / Re: Invalid File Size
Last post by sjj1805 - August 05, 2024, 03:07:45 AM
Quote from: ron4mac on August 04, 2024, 03:53:45 AM
The error messages reveal that the file include/exif.php is an old version that does not match the version that should be with CPG 1.6.26 (it is from prior to 1.6.16).  You should run the Versionchecker to see what else may not be correct.

Yes it was indeed the culprit!
Thank you Ron4Mac
:)
#76
cpg1.6 miscellaneous / Re: Invalid File Size
Last post by sjj1805 - August 04, 2024, 10:29:16 AM
I forgot to mention, also copy your "Albums" directory over
#77
cpg1.6 miscellaneous / I think I have fixed it
Last post by sjj1805 - August 04, 2024, 10:27:05 AM
An idea sprung to mind and I ask myself why I didn't think of this before.
This "Fix" should cure most of our problems!
My coppermine installation is in a folder I named "Cphoto"
1. Create  new folder on my web server and name it something else. I called this one "Xphoto"
2. Download a clean intallation of coppermine from the coppermine website
3. Copy your "..\include\config.inc.php from the existing folder to the new folder
4. Test and you should find everything works as it should

All that then remains is to restore any modifications yiou may have made to your existing installation - probably best to do one item at a time and check just in case your modification was the reason.

Hopefully this will help others facing seemingly uncurable issues
#78
cpg1.6 miscellaneous / Re: Invalid File Size
Last post by ron4mac - August 04, 2024, 03:53:45 AM
The error messages reveal that the file include/exif.php is an old version that does not match the version that should be with CPG 1.6.26 (it is from prior to 1.6.16).  You should run the Versionchecker to see what else may not be correct.
#79
cpg1.6 miscellaneous / Invalid File Size
Last post by sjj1805 - August 03, 2024, 07:06:25 PM
on Some of my albums, some of my images when viewed from the thumnail view but not all will come up with an error message
"Fatal error: Uncaught Error: Call to undefined function validSize() in M:\inetpub\wwwroot\cphoto\include\makers\gps.php:276 Stack trace: #0 M:\inetpub\wwwroot\cphoto\include\exif.php(776): parseGPS() #1 M:\inetpub\wwwroot\cphoto\include\exif.php(979): read_entry() #2 M:\inetpub\wwwroot\cphoto\include\exif_php.inc.php(48): read_exif_data_raw() #3 m:\inetpub\wwwroot\cphoto\displayimage.php(209): exif_parse_file() #4 m:\inetpub\wwwroot\cphoto\displayimage.php(461): html_picinfo() #5 {main} thrown in M:\inetpub\wwwroot\cphoto\include\makers\gps.php on line 276"

If I view the same album with either of the two slideshow options (HTML5 Slideshow) or click the image to view slideshow, then the slideshow plays all of the images
I have discovered that if I remove/rename the Full size Image then the error does not appear and the thumbnail view image displays correctly.

I have compared the full size image dimensions and all are identical, those that display and those that bring up the error.
I have tried resizing the images larger, smaller and nothing cures the problem

I am using an IIS webserver both on Windows 10 and also on another home com,puter with Windows 11.
My version of coppermine is 1.6 which I have kept up to date whenever a message appears telling me that there are updates available.
in the coppermine config I have increased the file size settings to
Max size for uploaded files 4MB
Max width or height for uploaded pictures 4096 pixels

I have run out of ideas to fix what has been working in the past for years.
Any Suggestions anyone?
#80
cpg1.6 themes (visuals) / Add smileys to comment box in ...
Last post by rsgj0098 - August 02, 2024, 08:35:04 PM
Hi, newbie question so apologies if (a) it's in the wrong place or (b) it's a stupid question  ;D

I have a forum running under SMF with a Coppermine gallery bridged to it. It's relatively simple (although time consuming..!) to add new smileys there, but how do I add them to Coppermine, so they are available when users post comments..?