Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2021-06-26 03:32:44

kaline
Member
From: Plymouth, MN
Registered: 2005-07-18
Posts: 38
Website

zem_ir problems

Hi all,

I updated an old site to the latest and greatest 4.8.7 today, and overall things went better than expected. The only problem I’m seeing is that I can’t get the zem_ir plugin to work. It tells me “Error: unable to create cache folder ‘/images/zir’.”

The folder is already there, so I’m not sure what the problem is. I tried to find the plugin support topic for this plugin, but couldn’t find it.

My PHP version is 7.4. This was working with the older version of Textpattern and PHP 5.6.

All I’m doing with this is converting a header into an image using a ttf font. Any suggestions would be appreciated!

Offline

#2 2021-06-26 08:53:16

etc
Developer
Registered: 2010-11-11
Posts: 5,235
Website GitHub

Re: zem_ir problems

Hi,

I suspect the plugin uses a relative path and is looking for a wrong directory. But

I tried to find the plugin support topic for this plugin, but couldn’t find it.

Would you mind posting the plugin’s code somewhere?

Offline

#3 2021-06-26 20:13:26

kaline
Member
From: Plymouth, MN
Registered: 2005-07-18
Posts: 38
Website

Re: zem_ir problems

Sure. I added it to a gist here
Hopefully you’re able to see it.

Last edited by kaline (2021-06-26 20:15:11)

Offline

#4 2021-06-26 21:46:44

etc
Developer
Registered: 2010-11-11
Posts: 5,235
Website GitHub

Re: zem_ir problems

After adding $path_to_site to global variables at the beginning of zem_ir_get_atts() function, you can try to replace "$img_dir/zir" on line 26, with

$path_to_site.DS.$img_dir.DS.'zir'

Not sure it helps, since the plugin worked before, but well… Also check whether your image directory starts with / (normally it shouldn’t).

Offline

#5 2021-06-30 14:59:34

kaline
Member
From: Plymouth, MN
Registered: 2005-07-18
Posts: 38
Website

Re: zem_ir problems

Thanks for the suggestion, @etc. I tried it out but it didn’t seem to help. I don’t get the error, though. But the header doesn’t appear. I’ll keep digging.

Offline

#6 2021-06-30 15:39:23

kaline
Member
From: Plymouth, MN
Registered: 2005-07-18
Posts: 38
Website

Re: zem_ir problems

So I’m stumped where my problem is happening, but I think I’m close. Looking at the developer console, it can’t find the image that’s been created because it’s trying to go to http://home/kaline/localtreasureinternational.com instead of https://localtreasureinternational.com. The images directory and file name it appends to that are correct, but the first part is trying to go to my document root instead of the site url. Everything else seems to be working fine.

Offline

#7 2021-06-30 15:42:38

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,468
Website GitHub

Re: zem_ir problems

Try hu instead of $path_to_site. That constant holds the web-accessible URL portion.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#8 2021-06-30 16:35:46

kaline
Member
From: Plymouth, MN
Registered: 2005-07-18
Posts: 38
Website

Re: zem_ir problems

OK. Changing that line to $cachedir = (empty($atts["cachedir"]) ? hu.DS.$img_dir.DS.'zir' : $atts["cachedir"]);
leads to Error: unable to create cache folder '/https://www.localtreasureinternational.com//images/zir'. Still close! Hopefully I made the correct change you asked for above.

Offline

#9 2021-06-30 17:10:02

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,742
Website

Re: zem_ir problems

You have two slashes in there: try changing hu.DS.$img_dir.DS.'zir' into hu.$img_dir.DS.'zir'. (DS means directory separator and as far as I recall hu already ends with a slash).


TXP Builders – finely-crafted code, design and txp

Offline

#10 2021-06-30 17:43:03

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,468
Website GitHub

Re: zem_ir problems

Weird. It sounds like it needs the full path (i.e. $path_to_site as Oleg correctly stated) to create the image but then needs the URL (hu) to view it. So you need to know where to use which one. One’ll be in a ‘create’ function and one’ll be in a ‘get’ function, I suspect.

But either way, zem_ir should have been doing that already. And that aspect of Txp hasn’t changed in years so I’d expect it to still work without any hacking.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#11 2021-06-30 17:51:12

etc
Developer
Registered: 2010-11-11
Posts: 5,235
Website GitHub

Re: zem_ir problems

It’s the leading / that troubles me most. There is no evidence where it comes from, and the original code would work without it, I suppose.

Offline

#12 2021-06-30 18:59:38

kaline
Member
From: Plymouth, MN
Registered: 2005-07-18
Posts: 38
Website

Re: zem_ir problems

Removing the first DS gets things really close. Now I just get the leading /, as etc pointed out: Error: unable to create cache folder '/https://www.localtreasureinternational.com//images/zir' Oh…actually I have an extra / in the url, too.

Ok. Fixed the extra / between the url and images, but still have the / at the beginning of the url.

Last edited by kaline (2021-06-30 19:40:09)

Offline

Board footer

Powered by FluxBB