Hey, guys. i met a very strange problem with 2.4 ImageField.
I upgraded a site from 2.3.6 to 2.4, imported the whole database and copy the whole assest folder.
Then, the problem came out.
It happnes on ImageField-[Replace Image], if you click the radio button [from the File Store] and select any image from the local file store and click the[replace]. This image will not be found in File Store anymore. I dont know why it act like this.
The imge is there on the asset folder but just cannot see in File Store through the ImageField anymore....
Anyone knows the solution to the problem?!
Thanks in advanced..
We've moved the forum!
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
Stop spaming Zatarsales04.... this doesnt help at all.
i was doing heaps of testing on this problem. and also simulated a similar enviroment to make sure that wont have the same problem.
I have found the 2.4 verison has the problem. The eariler versions are good..
The new discovery was found :
It will be fine if i use:
public static $has_one=array(
'HomePageImage'=>'Image',
'HomeImage'=>'Image'
);
Directly refer the Generic Image Class.
but will be problem if i use MyImage class extends Image Class
So,if i do something like
public static $has_one=array(
'HomePageImage'=>'MyImage',
'HomeImage'=>'MyImage'
);
This problem happens.
For your interests, the code in my MyImage Class is :
<?php
class MyImage extends Image{
public function generateHomeProductImage($gd) {
$gd->setQuality(100);
return $gd->croppedResize(285,150);
}
public function generateHomeSpotLightImage($gd)
{
$gd->setQuality(100);
return $gd->croppedResize(485,212);
}
}
?>
Anyone know whats going on here?!
Thanks...
I have encounterred lots of problem in ImageFiled and Image.php file.
I am not sure is there anything changes on 2.4. it seems the Image class cannot be extended to be customized(MyImage) anymore. It will always bring lots of problems when i was using MyImage to extend Image and adding the croppedresize function for MyImage.
I have also noticed the tutorial has been updated about the ImageField @ "recipes/imageupload.txt • Last modified: 2010/05/05 23:38 "
However, it doesn't mention the CustomizedImage can be applied to extend the Base Image Class as a another .php file in the mysite folder.
It seems the silverstripe team encourage developer to separate the corppedresize function into the /mysite/xxxx.php code after Page_Controller instead.
Not sure what’s going on THIS area. But really knee to know whether is anything wrong with my code or the traditional routine cannot be applied anymore?!
Alex
Hi there Alex.
There's a filter in the TreeDropdownField that only displays objects of type 'Folder' or 'Image'.
This patch: http://open.silverstripe.org/ticket/5708 will also display any objects that are a subclass of 'Image'.
Keep the faith,
Barry :-P
Hey.Barry.
Thanks for the ticket, seems we met the same problem with using the same image class to dealing with ImageField problem.
Thanks for pointing out the the filter can only filter "Image" class.
Everything extends Image cannot be found out using ImageField (upload from file store).
Keep the status up.
Would like to see solution soon.
We need to catch up in real life.
Regards.
Alex
Good patch many thanks!
Really helped me as the image did not appear in ImageGallery "Replace Image > From the File Store" only folders.