Comments (9)
Could you elaborate the issue more?
from cakephp-media-plugin.
Thanks for helping on this.
I've installed the media manager into a Cake installation to manage product images
Table structure for table images
:
CREATE TABLE IF NOT EXISTS images
(
id
int(11) NOT NULL AUTO_INCREMENT,
caption
varchar(45) DEFAULT NULL,
basename
varchar(45) DEFAULT NULL,
dirname
varchar(45) DEFAULT NULL,
default
tinyint(1) DEFAULT NULL,
created
datetime DEFAULT NULL,
modified
datetime DEFAULT NULL,
PRIMARY KEY (id
)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
I've baked this model and it's controller and then installed media manager.
I added a test image which worked properly - creating the record in the database and the various size images that I require (thumb, category listing, product page).
However the delete function on a record in the table fails entirely and the edit function reports success but doesn't actually update the record.
Removing the above lines from my model allows the edit and delete functions to work again - at the cost of breaking media manager.
from cakephp-media-plugin.
could you paste the edit ctp?
from cakephp-media-plugin.
<fieldset>
<legend><?php echo **('Edit Image'); ?></legend>
<?php
echo $this->Form->input('id');
echo $this->Form->input('caption');
echo $this->Form->input('basename');
echo $this->Form->input('dirname');
echo $this->Form->input('default');
echo $this->Form->input('product_id');
?>
</fieldset>
from cakephp-media-plugin.
I see what the problem is.
Form->create('Image', array('type'=>'fie'));?>and your caption (if its the image) should be set to type file as well. Hope this helps
from cakephp-media-plugin.
Oh my word - sorry to waste your time on that - that fixed the edit.
But the delete function still fails.
public function delete($id = null) {
if (!$this->request->is('post')) {
throw new MethodNotAllowedException();
}
$this->Image->id = $id;
if (!$this->Image->exists()) {
throw new NotFoundException(__('Invalid image'));
}
if ($this->Image->delete()) {
$this->Session->setFlash(__('Image deleted'));
$this->redirect(array('action'=>'index'));
} else {
$this->Session->setFlash(__('Image was not deleted'));
$this->redirect(array('action' => 'index'));
}
}
This always flashes "Image was not deleted". I have debugged and checked that $id is being passed correctly.
As soon as I remove the media behaviours from the model I am able to delete the images.
By "delete" I mean "delete from database". I do have an unlink function to remove them from disk, which I've commented out until I get the database function working.
from cakephp-media-plugin.
Now this is weird, from the sites I made, it CRUD should work as long as the steps are followed, it will also delete the image linked with the data as well.
Thanks for bringing it up. Let me get back to you on this.
from cakephp-media-plugin.
This is very old, I'd say it can be closed until someone can come up with a reproducible problem.
from cakephp-media-plugin.
Good point!
from cakephp-media-plugin.
Related Issues (20)
- Restructure included 'mm' library HOT 7
- Problems with TransferBehavior::checkExtension HOT 3
- Fatal error: HOT 2
- Warning (2): Invalid argument supplied for foreach() [APP/Plugin/Media/Model/Behavior/GeneratorBehavior.php, line 162] HOT 3
- Update installation documentation HOT 2
- 'Element' folder should be 'Elements' HOT 1
- Not able to display images in the view HOT 7
- Thumbnails not being generated HOT 4
- Videos not Working HOT 2
- Deleting /releasing images HOT 2
- Documentation issue HOT 1
- No uploads in static dir HOT 2
- saveAll not working correctly in case validation is involved HOT 3
- MediaHelper should encode URLs HOT 2
- Should MediaHelper::embed()/embedAsObject() support URLs additionally to file paths? HOT 4
- Travis integration and backwards compatibility HOT 1
- using 'url' option with embed() method no longer makes a link HOT 13
- Improve helper's error reporting HOT 1
- issue with generator behavior HOT 8
- Cake 3.0 Version HOT 2
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 cakephp-media-plugin.