Alternative to Dynamic Image Overlay in Medals Mod?

Informative converse
Post Reply
tcasey
Topic Author
Posts: 2
Topics: 1
Country: Canada (ca)
Joined: Sat Nov 12, 2011 8:11 am

Alternative to Dynamic Image Overlay in Medals Mod?

Post by tcasey »

Hi Oddfish, I posted this on the Medal Mod thread at phpbb.com, but I thought I'd also post here to see if I could catch your attention. As I mentioned below, I'm just looking for a different method to call the dynamic images. I've been trying to explore ways to do it by altering the dynamic_image.php file, but haven't had any success since I don't really know what I'm doing. Thanks again!

I've used this mod in the past, but even with a new install I'm having issues with the dynamic images displaying properly. Is there any quick way to remove the overlay feature and instead have an image substitution? I managed to jury rig that on my old forums, but I can't remember how and am not a php guru in any sense of the word.

The overall concept would be the same, but instead of displaying, say, base-2.gif over base.gif, it would simply display base-2.gif. That way I just make my imagesets and upload them in the same manner, but theres no wonky image overlays.

Thanks for your time.

User avatar
oddfish
Site Admin
Posts: 70
Topics: 21
Country: New Zealand (nz)
Medals: 1
Advisor 2 (1)
Joined: Thu Nov 06, 2008 1:20 am

Re: Alternative to Dynamic Image Overlay in Medals Mod?

Post by oddfish »

a good question.

I'll take a look when I get home next week. Hopefully I can spot something for you.

cheers,
oddfish.

tcasey
Topic Author
Posts: 2
Topics: 1
Country: Canada (ca)
Joined: Sat Nov 12, 2011 8:11 am

Re: Alternative to Dynamic Image Overlay in Medals Mod?

Post by tcasey »

I actually managed to find a solution, though it isn't perfect. I'm still having problems with the mod displaying .png files as dynamic images. It works fine as .gif, but not with .png files...

Anyhow, all I did was change the first part of dynamic_image.php

From this:

Code: Select all

// Dynamic Medal Image creation
function create_dynamic_image($baseimg, $extraimg='')
{
	$image  = create_from_extention($baseimg);

	imagecolortransparent($image,imagecolorat($image,0,0));

	if ( file_exists($extraimg) and $extraimg <> '' )
	{
		$insert = create_from_extention($extraimg);

		$image = image_overlap($image, $insert);
		ImageDestroy ($insert);
	}

	Header ('Content-type: image/png');
	ImagePNG ($image);
	//Clean Up
	ImageDestroy ($image);
To this:

Code: Select all

// Dynamic Medal Image creation
function create_dynamic_image($baseimg, $extraimg='')
{
	$image  = create_from_extention($baseimg);

	imagecolortransparent($image,imagecolorat($image,0,0));

	if ( file_exists($extraimg) and $extraimg <> '' )
	{
		$insert = create_from_extention($extraimg);

		$image = image_overlap($image, $insert);
	}

	Header ('Content-type: image/png');
	ImagePNG ($insert);
	//Clean Up
	ImageDestroy ($image);
	ImageDestroy ($insert);
It was rather simple when I finally figured it out... Instead of calling for $image to display, it calls for $insert. Of course, that also involved keeping $insert in the memory, so I moved ImageDestroy down. I left the rest of the file intact, though I'm sure some of it is unnecessary when just calling only for the dynamic image.

Post Reply