Page 4 of 37
Re: Image Resizing Script required - a better one...
Posted: Tue Mar 07, 2017 9:57 am
by simonmlewis
So I can just add:
<?php
composer require imagine/imagine
?>
?? As it doesn't like that.
Re: Image Resizing Script required - a better one...
Posted: Tue Mar 07, 2017 9:58 am
by Celauran
No. You need to type that on the command line. Alternately, copy the contents I posted into composer.json and then run composer install (again from the command line).
Re: Image Resizing Script required - a better one...
Posted: Tue Mar 07, 2017 10:01 am
by simonmlewis
[text]php composer.phar install[/text]
How do I run this? Via CMD prompt??
I did that but it didn't like it. Maybe it needs some file path??
Re: Image Resizing Script required - a better one...
Posted: Tue Mar 07, 2017 10:03 am
by Celauran
simonmlewis wrote:[text]php composer.phar install[/text]
How do I run this? Via CMD prompt??
Yes
simonmlewis wrote:I did that but it didn't like it.
What does that mean?
simonmlewis wrote:Maybe it needs some file path??
You want to run it from your project's root directory, where the composer.json file is located.
Re: Image Resizing Script required - a better one...
Posted: Tue Mar 07, 2017 10:06 am
by simonmlewis
Issue attached.
Re: Image Resizing Script required - a better one...
Posted: Tue Mar 07, 2017 10:07 am
by Celauran
Looks like an error in the composer.json file itself. Please post the entire contents.
Re: Image Resizing Script required - a better one...
Posted: Tue Mar 07, 2017 10:08 am
by simonmlewis
Code: Select all
{
"name": "phpmyadmin/phpmyadmin",
"type": "application",
"description": "MySQL web administration tool",
"keywords": ["phpmyadmin","mysql","web"],
"homepage": "http://www.phpmyadmin.net/",
"license": "GPL-2.0+",
"authors": [
{
"name": "The phpMyAdmin Team",
"email": "phpmyadmin-devel@lists.sourceforge.net",
"homepage": "http://www.phpmyadmin.net/home_page/team.php"
}
],
"support": {
"forum": "https://sourceforge.net/p/phpmyadmin/discussion/Help",
"issues": "https://sourceforge.net/p/phpmyadmin/bugs/",
"wiki": "http://wiki.phpmyadmin.net/",
"source": "https://github.com/phpmyadmin/phpmyadmin"
},
"require": {
"php": ">=5.3.0"
},
"require-dev": {
"satooshi/php-coveralls": ">=0.6",
"phpunit/phpunit": "<4.2",
"phpunit/phpunit-selenium": ">=1.2"
}
"require": {
"willdurand/geocoder": "@stable"
}
}
Re: Image Resizing Script required - a better one...
Posted: Tue Mar 07, 2017 10:10 am
by Celauran
That's not the right composer.json. What does your directory structure look like? The composer.json in question should live in your project's root directory, not Apache's.
Re: Image Resizing Script required - a better one...
Posted: Tue Mar 07, 2017 10:12 am
by simonmlewis
When I installed it, it just went to put it in a default area of xamp, in php/phpmyadmin.
Are you saying it needs to be installed for each and every website?
If that is the case, I guess I need to uninstall, and where it asks where to install, tell in the folder of the website.
Yes?
Re: Image Resizing Script required - a better one...
Posted: Tue Mar 07, 2017 10:15 am
by Celauran
Composer itself need only be installed once. It's a program, fundamentally. Each project gets its own composer.json file, though. This allows for project-specific dependencies.
For instance, I have composer installed to /usr/local/bin/composer but will have a composer.json in ~/Sites/<ProjectName> for each project. Clear?
Re: Image Resizing Script required - a better one...
Posted: Tue Mar 07, 2017 10:16 am
by simonmlewis
So if I run that composer command line again, but from the root of the project??
Re: Image Resizing Script required - a better one...
Posted: Tue Mar 07, 2017 10:18 am
by Celauran
simonmlewis wrote:So if I run that composer command line again, but from the root of the project??
Right. If you've copied the composer.json I posted earlier to your project root and run
composer install from that same directory, it should pull in the dependencies for just that project and save them in a vendor directory.
Re: Image Resizing Script required - a better one...
Posted: Tue Mar 07, 2017 10:19 am
by simonmlewis
Gotchya. Done it in the right directory this time.
So do I jsut add an include "file.json" to the top of my admin page?
Re: Image Resizing Script required - a better one...
Posted: Tue Mar 07, 2017 10:21 am
by simonmlewis
So I now have a composer.json file in my project with that small bit of code you told me, anbout and a big composer.lock file.
Re: Image Resizing Script required - a better one...
Posted: Tue Mar 07, 2017 10:22 am
by Celauran
simonmlewis wrote:Gotchya. Done it in the right directory this time.
So do I jsut add an include "file.json" to the top of my admin page?
No. You want to include the generated autoloader, which is the line that was giving you the error earlier.
Code: Select all
require_once __DIR__ . '/vendor/autoload.php';
You may need to adjust which directory it looks in. The above will look in the current directory. You can wrap __DIR__ in dirname() to go up a directory and so on.