Tips and Tricks HQ Support Portal › Forums › WP PDF Stamper › PDF Stamper, fseek() Error
- This topic has 7 replies, 2 voices, and was last updated 14 years, 2 months ago by amin007.
-
AuthorPosts
-
September 11, 2010 at 11:41 am #1821wzpModerator
Hi Amin, per Ivy’s stated preference, I moved my query to the forums.
Any idea on what is causing, or status report, on my fseek() “May not be used on file pointers returned by fopen() if they use the http:// or ftp:// formats” error?
September 12, 2010 at 12:14 am #24180wzpModeratorJust “for the fun of it,” I replaced the URL of the source file I was trying to manually stamp, with the absolute path and got yet another error:
Warning: fopen(url-of-output-file-goes-here) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in /home/content/45/4753628054/html/wp-content/plugins/wp-pdf-stamper/lib/fpdf/fpdf.php on line 0
I then changed the “Destination Directory of Stamped Files” to the absolute path of the output directory. Note, the default was a URL path.
Now, manual stamping works!!!!!!!!!!!!!!
Okay, so now I’m going to see if I can make this work with eStore. I don’t mind if I have to use the absolute path of the “stamped file directory,” but I’d sure hate having to change the eStore file URLs into absolute paths.
Perhaps, since we now know how to workaround the issue, you could maybe code some kind of function that would convert URL to & from absolute paths?
September 12, 2010 at 12:42 am #24181wzpModeratorNow this is getting weird…
After I got it to work, using absolute paths for everything; manual stamping is suddenly working with URLs.
Perhaps there is some kind of uninitialized database or variable situation going on here? Wil do some more testing and will report back…
September 12, 2010 at 1:11 am #24182wzpModeratorSigh, you’re still going to have to code an abolute path to/from URL conversion function…
When trying to delete files under “Manage Stamped Files,” I get:
Warning: unlink() [function.unlink]: http does not allow unlinking in /home/content/44/477758054/html/wp-content/plugins/wp-pdf-stamper/manage_stamped_files_page.php on line 0
I figure it’s because it’s trying to unlink files based on their URL.
Well, now that I know to to tippy-toe around these issues, I can at least move forward; and you get a wee-bit more space in order to properly fix PDF Stamper, LOL.
As for the original problem with the fssek() I kind of suspect that it can only be recreated on a clean installation, that has never had PDF Stamper installed.
September 12, 2010 at 1:22 am #24183wzpModeratorP.S. before deleting the entries from the “Managed Stamped Files” database, I think you should test to ensure the unlink() was successful. Otherwise, in case of failed unlink() like in this situation, the database and the directory will be out of sync.
September 12, 2010 at 2:00 am #24184amin007ParticipantBoth Relative or Full URL will work with the stamping. You just need to make sure that you are entering the relative path correctly as it needs to be relative to the PDF stamper’s “api” directory otherwise when it tries to open the file it won’t find the path.
This is why using a full URL in this case is easier as you don’t have to calculate what the relative URL should be for each of your files as you just copy the URL of the file and paste it in the field.
“I think you should test to ensure the unlink() was successful” – that’s what you will ideally do but an unlink can go wrong for a lot of reasons and I didn’t want the users to be stuck with the entry in the database as the unlink is failing (sometimes you just won’t be able to get it to work). It’s really easy to delete the files from your server just by browsing to the “stamped-files” directory and deleting the files manually if an unlink goes bad. This way you know that the database record was successfully cleaned and you just need to manually delete the file from the “stamped-files” directory (all the files are time stamped so you can delete them in bulk every month or so)
I do have plans to add a feature so the admin can schedule an auto deletion of stamped files after so many hours.
September 12, 2010 at 2:04 am #24185wzpModeratorThe “API directory” is the plugin directory?
September 12, 2010 at 2:19 am #24186amin007ParticipantInside the PDF stamper directory there is a folder called “api”
So for example if you had a file uploaded in the following URL:
http://www.example.com/wp-content/uploads/testfile.pdf
The relative URL for the above (relative to the “api” directory) would be the following:
../../../uploads/testfile.pdf
-
AuthorPosts
- You must be logged in to reply to this topic.