Comments (6)
Hi Nicholas,
What do you mean by update? Media is just an eloquent model, so you can
adjust any of its attributes manually, I.e. $media->mime_type = 'image/jpeg';
then call the save() method to update the records.
(On vacation so I might be slow to reply)
On Sep 1, 2016 4:19 PM, "Nicolas Binet" [email protected] wrote:
I'm trying to figure out a way to update a saved media.
Relations can be updated, but not the base file.
Am-I right ?—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#18, or mute the thread
https://github.com/notifications/unsubscribe-auth/AA38rDxvACl4rk3pCDph0znCDRZ9aoDfks5qltD6gaJpZM4JyrmK
.
from laravel-mediable.
Let me know if I'm wrong, but I'm using MediaUploader::fromSource to upload and create a new Media.
But, there is no "updateFromSource" method to update an existing one.
from laravel-mediable.
Hi Nicolas,
What exactly has changed between the file on disk and the data stored in
the db record?
For the most part, the library considers media files to be constant once
uploaded, as this fits with the most common usage. That said, if you are
manipulating the file and you know what might change (e.g. size, mime,
etc.), you can update the fields manually, as described in the message
above.
You can also simply delete and reimport the media record.
Alternatively, the media:import
command has a --force
option, which
checks if any files in a directory no longer match their records and update
accordingly.
Finally, adding a proper MediaUploader::update()
method is on my to-do
list for the next major or minor version. This would behave like
media:import --force
for a single file at a time. Still in the works
though.
Hope this helps.
On Sep 3, 2016 12:56 PM, "Nicolas Binet" [email protected] wrote:
Let me know if I'm wrong, but I'm using MediaUploader::fromSource to
upload and create a new Media.
But, there is no "updateFromSource" method to update an existing one.—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#18 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AA38rNaDO92hkRe9o1Cz_9UGwq0yz_n5ks5qmVJagaJpZM4JyrmK
.
from laravel-mediable.
Hi frasmage,
Thanks for your extensive answer.
In my case, I'm trying to create a mediamanager the "wordpress way". Have a centralized repositories for medias, and associate them along the way to different models.
And sometimes I will, or one of my client will, want to re-upload a new version of a file, thus updating all it's uses.
In that case I don't want to delete the file, as it would break all relations.
I hope this clarifies my need.
Nicolas
from laravel-mediable.
Hi Nicolas,
OK, I see what you mean. The MediaUploader class wouldn't be able to do
that out of the box (though the update feature I'm working on would help).
In the meantime, you could use the uploader to place the file in a temp
location (for validation, media generation, etc.), then manually swap the
two files on disk and update the original record with the attributes of the
new one.
On Sep 7, 2016 7:42 AM, "Nicolas Binet" [email protected] wrote:
Hi frasmage,
Thanks for your extensive answer.
In my case, I'm trying to create a mediamanager the "wordpress way". Have
a centralized repositories for medias, and associate them along the way to
different models.
And sometimes I will, or one of my client will, want to re-upload a new
version of a file, thus updating all it's uses.
In that case I don't want to delete the file, as it would break all
relations.I hope this clarifies my need.
Nicolas
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#18 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AA38rGuqAEY50n-Av849m8GGpN3iSFPlks5qnk7DgaJpZM4JyrmK
.
from laravel-mediable.
Hi @nicolasbinet, this is now implemented in version 2.0, see the docs for instructions on this feature.
from laravel-mediable.
Related Issues (20)
- Uploading to S3 from remote url directly HOT 3
- [Error] Attempted to lazy load [variants] on model [Plank\Mediable\Media] but lazy loading is disabled. HOT 1
- Unable to install on laravel 10.10 HOT 2
- Slow syncing HOT 2
- Getting Issue in laravel 10 while install plank / laravel-mediable version 5.9 HOT 1
- Resize image files insize controller HOT 1
- Documentation is not clear how to use the package HOT 4
- SourceAdapter\UploadedFileAdapter bad mime_type from client HOT 2
- PHPStan - Add template to MediableCollection HOT 3
- How to build filament component as plank does not exposes any interface like HasMedia HOT 3
- Move media to root directory HOT 2
- File gets renamed upon upload? HOT 1
- Call to undefined method Plank\Mediable\ImageManipulation::toPngFormat() HOT 4
- Files are not removed from disk on deleting the variants HOT 3
- The Chinese file name is automatically changed to pinyin,I want a Chinese name HOT 2
- Import changes visility on original file HOT 4
- Support `intervention/image` ^3.0 HOT 10
- Upload Media on AWS S3 private Bucket HOT 4
- detach relations does not work on delete HOT 1
- base64 uploading HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-mediable.