composer require saves you from writing tons of boilerplate.Image Resizing Script required - a better one...
Moderator: General Moderators
Re: Image Resizing Script required - a better one...
You could in theory download the Imagine library manually, set up your own autoloading, and thereby bypass Composer. Seems unnecessarily complicated to me, though. A few simple
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Re: Image Resizing Script required - a better one...
I just tried.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
Re: Image Resizing Script required - a better one...
Having not used Windows since Win7 was new, I'm afraid I'll be worse than useless at helping you resolve that. You could try the manual installation. Otherwise, you'll need to rely on Google to get that installed.
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Re: Image Resizing Script required - a better one...
Bugger.
What I am going to do in the meantime, is send my older code, with the longer-winded script to the guys we are doing this with to see if they can fathom how to make it work without additional libraries.
If it were to be done by a consumer, 'speed' may be important. But it isn't.
Does make one wonder how it works on Wordpress. Or maybe that uses a different engine for resizing. Though I Think that does it on the fly, as it is requested at user end.
What I am going to do in the meantime, is send my older code, with the longer-winded script to the guys we are doing this with to see if they can fathom how to make it work without additional libraries.
If it were to be done by a consumer, 'speed' may be important. But it isn't.
Does make one wonder how it works on Wordpress. Or maybe that uses a different engine for resizing. Though I Think that does it on the fly, as it is requested at user end.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
Re: Image Resizing Script required - a better one...
Fair enough for the meantime, but I strongly advise against giving up on Composer. It's not really optional for modern PHP development. Wish I could help more, but haven't touched Windows in ages.simonmlewis wrote:Bugger.
What I am going to do in the meantime, is send my older code, with the longer-winded script to the guys we are doing this with to see if they can fathom how to make it work without additional libraries.
You could just look at their code.simonmlewis wrote:Does make one wonder how it works on Wordpress.
Only the first time a particular size is requested. Once it's saved to the disk, that's what gets served.simonmlewis wrote:Though I Think that does it on the fly, as it is requested at user end.
Re: Image Resizing Script required - a better one...
Going to require some digging, but you could start here:
https://github.com/WordPress/WordPress/ ... d.php#L142
https://github.com/WordPress/WordPress/ ... d.php#L142
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Re: Image Resizing Script required - a better one...
Yes so it must check for each image shown, if it exists or not. And if not, it then creates it on the fly.
That might even be a better way of doing it. And when Admin delete the main image, it checks if there are the other three versions on the server, and delete those.
But I am assuming we need Composer to do this 'on the fly' stuff?
That might even be a better way of doing it. And when Admin delete the main image, it checks if there are the other three versions on the server, and delete those.
But I am assuming we need Composer to do this 'on the fly' stuff?
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
Re: Image Resizing Script required - a better one...
Take a look at your old code. Take a look at the WordPress code. Heck, take a look at the Imagine code. It can all be done using PHP's built-in functionality. The point of leveraging third-party libraries is that the heavy lifting is already done for you and you can just call it via a simple public API.
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Re: Image Resizing Script required - a better one...
It's installed. There was some issue, but when I Tried it again, it worked.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Re: Image Resizing Script required - a better one...
I'm still getting that error. It was installed using the default settings, so would in theory run for all sites on my laptop.
But those two line errors show up.
But those two line errors show up.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Re: Image Resizing Script required - a better one...
Warning: require_once(C:\xampp\phpMyAdmin\site-wide/vendor/autoload.php): failed to open stream: No such file or directory in C:\xampp\phpMyAdmin\site-wide\includes\a_home.inc on line 616
Fatal error: require_once(): Failed opening required 'C:\xampp\phpMyAdmin\site-wide/vendor/autoload.php' (include_path='.;C:\xampp\php\PEAR') in C:\xampp\phpMyAdmin\site-wide\includes\a_home.inc on line 616
Line 616 is this:
require_once dirname(__DIR__) . '/vendor/autoload.php';
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
Re: Image Resizing Script required - a better one...
Have you created your composer.json file? Are you pulling in Imagine? Are you looking for the autoload file in the right place?
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Re: Image Resizing Script required - a better one...
That page you sent doesn't state about creating a composer.json file. I'm using that code you sent me.
require_once dirname(__DIR__) . '/vendor/autoload.php';
$imagine = new Imagine\Gd\Imagine();
require_once dirname(__DIR__) . '/vendor/autoload.php';
$imagine = new Imagine\Gd\Imagine();
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
Re: Image Resizing Script required - a better one...
https://getcomposer.org/doc/01-basic-usage.md
You need to tell composer which packages you need. For this case, calling this should suffice:
Alternately, create a composer.json in your project's root directory with the following contents:
and run
You need to tell composer which packages you need. For this case, calling this should suffice:
Code: Select all
composer require imagine/imagineCode: Select all
{
"require": {
"imagine/imagine": "^0.6.3"
}
}composer install