Skip to content
This repository has been archived by the owner on Mar 5, 2022. It is now read-only.

Quick Start Guide instructions issue #86

Closed
artnos opened this issue Aug 16, 2015 · 14 comments
Closed

Quick Start Guide instructions issue #86

artnos opened this issue Aug 16, 2015 · 14 comments

Comments

@artnos
Copy link

artnos commented Aug 16, 2015

https://github.com/burzum/cakephp-file-storage/blob/3.0/docs/Tutorials/Quick-Start.md

I get this error in my upload.ctp

Notice (8): Undefined variable: productImage [APP/Template/Products/upload.ctp, line 12]

in your controller you never set $productImages

class ProductsController extends AppController {
    // Upload an image
    public function upload($productId = null) {
        if (!$this->request->is('get')) {
            if ($this->Products->ProductImages->upload($productId, $this->request->data)) {
                $this->Flash->set(__('Upload successful!');
            }
        }
    }
}

What is the correct way? Can you guys share a project with this working so i can dissect it. Thank you

@burzum
Copy link
Owner

burzum commented Aug 16, 2015

I've updated the documentation, please try it again, haven't tested it myself because I would have to set the whole thing up again.

There is no project public available that uses the plugin, as far as I know, and I don't think it is necessary. The plugin comes with a ton of documentation. If you need personal assistance you can hire me.

The issue you found wasn't hard to fix either, I guess you're a beginner in CakePHP, so I would recommend you to do the blog tutorial first. The documentation might still have here and there more or less old code examples because it was updated from CakePHP 2.x, I thought I've got all the things right but obviously there are still some things left... sorry!

@artnos
Copy link
Author

artnos commented Aug 16, 2015

Thank you for getting back to me, I appreciate all your work.
One quick last question if you dont mind

In the quickstart in your controller you call
$this->Products->ProductImages->upload($productId, $entity)

But in your table and ImageStorageTable that you extend there is no upload,
you have
public function uploadImage($productId, $entity) {

Should it be using that instead?

On Sun, Aug 16, 2015 at 6:36 AM, Florian Krämer notifications@github.com
wrote:

Closed #86.


Reply to this email directly or view it on GitHub.

Art Siriamonthep

@artnos
Copy link
Author

artnos commented Aug 16, 2015

Thanks for answer in the cake chat

I got the files to upload to the table but it wont appear in my tmp
folder even after I changed adaptor-option

I noticed the link you provided me in the chat was file-storage master
branch i was using the 3.0 branch which one should i be using? Master?

On Sun, Aug 16, 2015 at 8:55 AM, Art Sir artnos@gmail.com wrote:

Thank you for getting back to me, I appreciate all your work.
One quick last question if you dont mind

In the quickstart in your controller you call
$this->Products->ProductImages->upload($productId, $entity)

But in your table and ImageStorageTable that you extend there is no upload,
you have
public function uploadImage($productId, $entity) {

Should it be using that instead?

On Sun, Aug 16, 2015 at 6:36 AM, Florian Krämer notifications@github.com
wrote:

Closed #86.


Reply to this email directly or view it on GitHub.

Art Siriamonthep

Art Siriamonthep

@burzum
Copy link
Owner

burzum commented Aug 16, 2015

I noticed the link you provided me in the chat was file-storage master

Sorry!

branch i was using the 3.0 branch which one should i be using? Master?

3.0 = CakePHP 3.0
master = CakePHP 2.0

Use Composer: ~0.0 for CakePHP 2 and ~1.0 for CakePHP 3.0. See https://github.com/burzum/cakephp-file-storage/wiki/Roadmap

@artnos
Copy link
Author

artnos commented Aug 16, 2015

Hey, just wanted to let you know it works now. It was something really dumb
my fault. Thank you for your patience.

On Sun, Aug 16, 2015 at 11:23 AM, Florian Krämer notifications@github.com
wrote:

I noticed the link you provided me in the chat was file-storage master

Sorry!

branch i was using the 3.0 branch which one should i be using? Master?

3.0 = CakePHP 3.0
master = CakePHP 2.0

Use Composer: ~0.0 for CakePHP 2 and ~1.0 for CakePHP 3.0. See
https://github.com/burzum/cakephp-file-storage/wiki/Roadmap


Reply to this email directly or view it on GitHub
#86 (comment)
.

Art Siriamonthep

@artnos
Copy link
Author

artnos commented Aug 19, 2015

Hey man, I hate to bother you again. I am really trying to figure this out
on my own. When I pass in my ID from the file storage table through the
image helper it doesn't work or return anything.

I attached an image to my situatio. Thank you for your time.
[image: Inline image 1]

On Sun, Aug 16, 2015 at 3:11 PM, Art Sir artnos@gmail.com wrote:

Hey, just wanted to let you know it works now. It was something really
dumb my fault. Thank you for your patience.

On Sun, Aug 16, 2015 at 11:23 AM, Florian Krämer <notifications@github.com

wrote:

I noticed the link you provided me in the chat was file-storage master

Sorry!

branch i was using the 3.0 branch which one should i be using? Master?

3.0 = CakePHP 3.0
master = CakePHP 2.0

Use Composer: ~0.0 for CakePHP 2 and ~1.0 for CakePHP 3.0. See
https://github.com/burzum/cakephp-file-storage/wiki/Roadmap


Reply to this email directly or view it on GitHub
#86 (comment)
.

Art Siriamonthep

Art Siriamonthep

@artnos
Copy link
Author

artnos commented Aug 19, 2015

I think it has something to do with the hash field. It's empty.

On Wed, Aug 19, 2015 at 11:15 AM, Art Sir artnos@gmail.com wrote:

Hey man, I hate to bother you again. I am really trying to figure this out
on my own. When I pass in my ID from the file storage table through the
image helper it doesn't work or return anything.

I attached an image to my situatio. Thank you for your time.
[image: Inline image 1]

On Sun, Aug 16, 2015 at 3:11 PM, Art Sir artnos@gmail.com wrote:

Hey, just wanted to let you know it works now. It was something really
dumb my fault. Thank you for your patience.

On Sun, Aug 16, 2015 at 11:23 AM, Florian Krämer <
notifications@github.com> wrote:

I noticed the link you provided me in the chat was file-storage master

Sorry!

branch i was using the 3.0 branch which one should i be using? Master?

3.0 = CakePHP 3.0
master = CakePHP 2.0

Use Composer: ~0.0 for CakePHP 2 and ~1.0 for CakePHP 3.0. See
https://github.com/burzum/cakephp-file-storage/wiki/Roadmap


Reply to this email directly or view it on GitHub
#86 (comment)
.

Art Siriamonthep

Art Siriamonthep

Art Siriamonthep

@robertpustulka
Copy link
Contributor

@artnos Which version are you using? Can you paste the code which isn;t working as expected?

@artnos
Copy link
Author

artnos commented Aug 19, 2015

The code that isn't working as expect is $this->Image->display(
$product->file_storage[0]->id );
I echo $product->file_storage[0]->id and the id from the file_storage
table is returned.
I added the Image helper in app view
Upload works fine and is added to my file_storage table

i did composer install on
"burzum/file-storage": "3.0.@dev",
"burzum/cakephp-imagine-plugin": "3.0.
@dev",

I attached an image that displayed all the things i checked
thank you so much for taking the time

[image: Inline image 1]

On Wed, Aug 19, 2015 at 2:57 PM, Robert Pustułka notifications@github.com
wrote:

@artnos https://github.com/artnos Which version are you using? Can you
paste the code which isn;t working as expected?


Reply to this email directly or view it on GitHub
#86 (comment)
.

Art Siriamonthep

@artnos
Copy link
Author

artnos commented Aug 19, 2015

img link here
https://www.dropbox.com/s/tirgkx6su83s2xc/file-storage.jpg?dl=0

On Wed, Aug 19, 2015 at 3:33 PM, Art Sir artnos@gmail.com wrote:

The code that isn't working as expect is $this->Image->display(
$product->file_storage[0]->id );
I echo $product->file_storage[0]->id and the id from the file_storage
table is returned.
I added the Image helper in app view
Upload works fine and is added to my file_storage table

i did composer install on
"burzum/file-storage": "3.0.@dev",
"burzum/cakephp-imagine-plugin": "3.0.
@dev",

I attached an image that displayed all the things i checked
thank you so much for taking the time

[image: Inline image 1]

On Wed, Aug 19, 2015 at 2:57 PM, Robert Pustułka <notifications@github.com

wrote:

@artnos https://github.com/artnos Which version are you using? Can you
paste the code which isn;t working as expected?


Reply to this email directly or view it on GitHub
#86 (comment)
.

Art Siriamonthep

Art Siriamonthep

@robertpustulka
Copy link
Contributor

@artnos ImageHelper methods work on an entity, not an id.

Try:

$this->Image->display($product->file_storage[0]);

@artnos
Copy link
Author

artnos commented Aug 19, 2015

oh okay! thank you, so i passed in
//$product->file_storage[0]
and it gave me an image!

awesome making progress!
but my image is located in the folder 'files'
so it should be
files/images/Products/43/77/81/e5b6d825cc574f1587bafe16e0aca67e/e5b6d825cc574f1587bafe16e0aca67e.19e760eb.jpg

here is my storage manager

StorageManager::config('Local', [
'adapterOptions' => [ROOT . DS . 'webroot' . DS . 'files' ], // Your
base path here
'adapterClass' => '\Gaufrette\Adapter\Local',
'class' => '\Gaufrette\Filesystem'
]);

do you know why it doesn't pick up that they are in the files folder or is
that something i have to handle in the view

On Wed, Aug 19, 2015 at 4:20 PM, Robert Pustułka notifications@github.com
wrote:

@artnos https://github.com/artnos ImageHelper methods work on an
entity, not an id.


Reply to this email directly or view it on GitHub
#86 (comment)
.

Art Siriamonthep

@Adnan0703
Copy link
Contributor

@artnos ImageProcessingListener adds the images prefix, here. You must be using LocalFileStorageListener which adds the files prefix, here. With ImageProcessingListener ImageStorageTable will be used.

@artnos
Copy link
Author

artnos commented Aug 20, 2015

Thank you that helps !

On Wed, Aug 19, 2015 at 9:56 PM, Adnan0703 notifications@github.com wrote:

@artnos https://github.com/artnos ImageProcessingListener adds the
images prefix, here
https://github.com/burzum/cakephp-file-storage/blob/3.0/src/Event/ImageProcessingListener.php#L261.
You must be using LocalFileStorageListener which adds the files prefix,
here
https://github.com/burzum/cakephp-file-storage/blob/3.0/src/Event/LocalFileStorageListener.php#L81
.


Reply to this email directly or view it on GitHub
#86 (comment)
.

Art Siriamonthep

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

No branches or pull requests

4 participants