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

How can i make image file on insert or update with rename and make thumb files? #52

Closed
c1t1zen opened this issue Jul 5, 2016 · 11 comments
Assignees

Comments

@c1t1zen
Copy link

c1t1zen commented Jul 5, 2016

hello!
How can i make image file on insert or update with rename and make thumb files?

@c1t1zen
Copy link
Author

c1t1zen commented Jul 10, 2016

Hey!

any help int that ?
i dont know if i can resize and rename image on upload or not with this package?

thank you in advance

@tabacitu
Copy link
Member

Hi!

Sure, you can use the "browse" field type and, on your model, use a mutator
to crop/resize/whatever you want to do with your image.

function setImageAttribute($value) {
// use Intervention image or whatever you want to process that image
$this->attribute['image'] = $value;
}

On Sunday, 10 July 2016, c1t1zen [email protected] wrote:

Hey!

any help int that ?
i dont know if i can resize and rename image on upload or not with this
package?

thank you in advance


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#52 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AA_BGuhkh_geIcJvr0QJQAIxqhHEo09Xks5qUM-WgaJpZM4JFUMG
.

[image: photo]
Cristian Tăbăcitu
Managing Partner UPDIVISION
http://s.wisestamp.com/links?url=http%3A%2F%2Fupdivision.com&sn=Y3Jpc3RpdGFiYWNpdHVAZ21haWwuY29t
http://s.wisestamp.com/links?url=http%3A%2F%2Falternopedia.ro&sn=Y3Jpc3RpdGFiYWNpdHVAZ21haWwuY29tBoard
Member Ideo Ideis
http://s.wisestamp.com/links?url=http%3A%2F%2Fideoideis.ro&sn=Y3Jpc3RpdGFiYWNpdHVAZ21haWwuY29t
| mobile: +4 0752 233 319 | website: http://tabacitu.ro/
http://s.wisestamp.com/links?url=http%3A%2F%2Ftabacitu.ro&sn=Y3Jpc3RpdGFiYWNpdHVAZ21haWwuY29t
[image: Facebook]
http://s.wisestamp.com/links?url=https%3A%2F%2Fwww.facebook.com%2Ftabacitu&sn=Y3Jpc3RpdGFiYWNpdHVAZ21haWwuY29t
[image: LinkedIn]
http://s.wisestamp.com/links?url=http%3A%2F%2Fro.linkedin.com%2Fin%2Ftabacitu&sn=Y3Jpc3RpdGFiYWNpdHVAZ21haWwuY29t
[image: Google Plus]
http://s.wisestamp.com/links?url=http%3A%2F%2Fplus.google.com%2F111602517732305461201&sn=Y3Jpc3RpdGFiYWNpdHVAZ21haWwuY29t
Video conference: [image: Google Talk] cristitabacitu [image: Skype]
cristitabacitu

@c1t1zen
Copy link
Author

c1t1zen commented Jul 12, 2016

Thank you alot
i did make it in this link for other people so they can do it if they need

#57

@c1t1zen
Copy link
Author

c1t1zen commented Jul 12, 2016

can i get last inserted id in modal in ?

function setImageAttribute($value) {
// use Intervention image or whatever you want to process that image
$this->attribute['image'] = $value;
}

thank you again

@tabacitu
Copy link
Member

Sure, just get the current id using $this->id

@c1t1zen
Copy link
Author

c1t1zen commented Jul 12, 2016

yes i did put $this->id in method but did not work i got null

function setImageAttribute($value) {
// use Intervention image or whatever you want to process that image
$this->attribute['image'] = $this->id.''.$value;
}
when i checked table it does not print the id as id
$value

@tabacitu
Copy link
Member

That's odd. I have quite a few mutators working this way.

  1. Are you sure you have your image in your $fillable array, on your model? The CRUD will only save what's in the fillable array.
protected $fillable = ['name', 'image'];
  1. Try looking at the Laravel documentation on Mutators, maybe you've missed something. Doing a dd($this->id); in your setImageAttribute() method should dump the correct ID.

@c1t1zen
Copy link
Author

c1t1zen commented Jul 14, 2016

it was
protected $fillable = ['slug', 'title', 'content', 'image', 'status', 'category_id', 'featured', 'date'];
i can save image name after rename it with no problem but when i try to add
id_imageName.jpg it just save as _imageName.jpg in the db table

@tabacitu
Copy link
Member

Does $this->getKey() work, instead of $this->id?

@tabacitu
Copy link
Member

tabacitu commented Aug 5, 2016

@c1t1zen,

Did this work for you? Can I close the issue?

Cheers!

@c1t1zen
Copy link
Author

c1t1zen commented Aug 18, 2016

yes Close it thank you

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

2 participants