Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot make it working in RAW PHP... pls help 🙇‍♂️ #389

Open
vitalijalbu opened this issue Feb 3, 2024 · 7 comments
Open

Cannot make it working in RAW PHP... pls help 🙇‍♂️ #389

vitalijalbu opened this issue Feb 3, 2024 · 7 comments

Comments

@vitalijalbu
Copy link

vitalijalbu commented Feb 3, 2024

http://localhost:8888/sportibile-uploads/uploads/1.png?w=10&h=10

Hi guys, I found the library very interesting but cannot make it working in localhost (using MAMP)

Here's my code, maybe I forgot something? I prefer to use core php and no frameworks because i will host the script in a subdomain.

<?php
require 'vendor/autoload.php';


use League\Glide\Responses\PsrResponseFactory;
use League\Glide\ServerFactory;

// Specify the path to your image directory
$imagePath = __DIR__ . '/uploads';

// Specify the URL path to your image directory
$baseUrl = 'http://localhost:8888/sportibile-uploads';



// Configure Glide server
$server = ServerFactory::create([
    'response' => new PsrResponseFactory(),
    'source' => '/uploads',
    'cache' => __DIR__ . '/cache',
    'base_url' => $baseUrl,
]);

// Handle image manipulation request
$server->outputImage($_SERVER['REQUEST_URI'], $_GET);
@deluxetom
Copy link

@vitalijalbu what is the error you're getting? it seems you got the source wrong when creating the server

@vitali-bc
Copy link

@vitalijalbu what is the error you're getting? it seems you got the source wrong when creating the server

hi, don't remember but would be great have some raw php demo aswell...

@deluxetom
Copy link

<?php
require 'vendor/autoload.php';

use League\Glide\ServerFactory;

// Configure Glide server
$server = ServerFactory::create([
    'source' => __DIR__ .'/source',
    'cache' => __DIR__ . '/cache',
    'base_url' => 'images/', // remove `images/` from $_SERVER['REQUEST_URI']
]);

// Handle image manipulation request
$server->outputImage($_SERVER['REQUEST_URI'], $_GET);

hope this helps

@vitalijalbu
Copy link
Author

<?php
require 'vendor/autoload.php';

use League\Glide\ServerFactory;

// Configure Glide server
$server = ServerFactory::create([
    'source' => __DIR__ .'/source',
    'cache' => __DIR__ . '/cache',
    'base_url' => 'images/', // remove `images/` from $_SERVER['REQUEST_URI']
]);

// Handle image manipulation request
$server->outputImage($_SERVER['REQUEST_URI'], $_GET);

hope this helps

Screenshot 2024-12-17 alle 18 26 55

@deluxetom
Copy link

where are your images located?
this error is normal if the paths arent setup correctly

@vitalijalbu
Copy link
Author

where are your images located? this error is normal if the paths arent setup correctly

Have a index.php file and a folder images which contains all of them, maybe cause i’m on subdirectory on my mamp server??👀

@deluxetom
Copy link

looks like the source path you defined was empty, try images or __DIR__.'/images'
the library is just returning a FileNotFoundException so it's just on your end now to figure out the paths for your machine and/or deployment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants