OXID Community Forum

> International Forums > Developers > Overriding oxUtilsPic::resizeImage()
Login
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Thread: Overriding oxUtilsPic::resizeImage()


Reply
 
Thread Tools Display Modes
#Top   #1  
Old 10-02-2011, 04:32 AM
Szilagyi Szilagyi is offline
Junior Member
Join Date: Sep 2011
Posts: 8
Szilagyi is on a distinguished road
Question Overriding oxUtilsPic::resizeImage()

Hello,

I want to replace / override oxUtilsPic::resizeImage() in the manner
PHP Code:
resizeImage(){
do 
something;
return 
parent::resizeImage();

Although oxUtilsPic is not to be found on the list of not overrideable classes, my module isn´t loaded. I would highly appreciate any hints.
Reply With Quote
#Top   #2  
Old 10-02-2011, 10:28 AM
Hebsacker's Avatar
Hebsacker Hebsacker is online now
Moderator
Join Date: Feb 2009
Location: Freie Republik Hohenlohe
Posts: 10,237
Hebsacker is on a distinguished road
Default AW: Overriding oxUtilsPic::resizeImage()

check here: http://wiki.oxidforge.org/Tutorials/..._image_handler
__________________
Ray
www.stahlwarenhaus-hebsacker.de______________._.__Tipps zur Forensuche
www.haller-stahlwaren.de____________________._____Tipps zum Forum
_________________________________________._____Forum für Dummies

_________________________________________._____Theme-Styler
Reply With Quote
#Top   #3  
Old 10-02-2011, 01:35 PM
Szilagyi Szilagyi is offline
Junior Member
Join Date: Sep 2011
Posts: 8
Szilagyi is on a distinguished road
Default AW: Overriding oxUtilsPic::resizeImage()

Hello,

thanks for this valuable information!
How ever, as I need to work with a productive shop of v 4.4 that will not be updated tll 2012, I would still need an way to override resizeImage().

Thanks a lot
Reply With Quote
#Top   #4  
Old 10-02-2011, 02:26 PM
leofonic leofonic is offline
Senior Member
Join Date: Oct 2009
Posts: 2,188
leofonic is on a distinguished road
Default AW: Overriding oxUtilsPic::resizeImage()

oxUtilsPic should be overloadable in usual way. Could you post the complete code and steps you tried?
__________________
Frank

www.zunderweb.de - Zunderweb IT Beratung
Ajax Multifilter XL - Turbo für den Attributfilter
Reply With Quote
#Top   #5  
Old 10-02-2011, 03:43 PM
Szilagyi Szilagyi is offline
Junior Member
Join Date: Sep 2011
Posts: 8
Szilagyi is on a distinguished road
Default AW: Overriding oxUtilsPic::resizeImage()

Hello,

I resorted to extend _resize(), but would extend anythink that gives the desired result.

In /modules/ is the file myresize.php :
PHP Code:
<?php
  
//add to modules: oxUtilsPic => myresize
  
class myresize extends myresize_parent
  
{
    protected function 
_resize$aImageInfo$sSrc$hDestinationImage$sTarget$iNewWidth$iNewHeight$iGdVer$blDisableTouch$iDefQuality )
    {
        exit(); 
//if script exits, I know this has been called.
        
        
return parent::_resize$aImageInfo$sSrc$hDestinationImage$sTarget$iNewWidth$iNewHeight$iGdVer$blDisableTouch$iDefQuality );
    }
  }
?>
The resizing works without alternation or desired exiting.

Last edited by Szilagyi; 10-02-2011 at 03:46 PM.
Reply With Quote
#Top   #6  
Old 10-02-2011, 06:26 PM
leofonic leofonic is offline
Senior Member
Join Date: Oct 2009
Posts: 2,188
leofonic is on a distinguished road
Default AW: Overriding oxUtilsPic::resizeImage()

Well i tried with a 4.4.4 and it exits. Maybe oxutilspic is instantiated too early, in this case it would help to add this to config.inc.php (but you also need the line in system/modules):
PHP Code:
$this->aModules = array(
'oxutilspic' => 'myresize'
); 
__________________
Frank

www.zunderweb.de - Zunderweb IT Beratung
Ajax Multifilter XL - Turbo für den Attributfilter
Reply With Quote
#Top   #7  
Old 10-03-2011, 03:07 AM
Szilagyi Szilagyi is offline
Junior Member
Join Date: Sep 2011
Posts: 8
Szilagyi is on a distinguished road
Default AW: Overriding oxUtilsPic::resizeImage()

Thanks for your effrots. I did try that, but had no success so far. How ever, as my change seems to be depreciated in a future update, I decided to hardcode it into the oxUtilsPic.php file.

The shop I work on has dozens of modules, but none for oxUtilsPic. Does it make any difference in what order they appear in that modules-textarea in the admin?

Thanks again

Zsolt
Reply With Quote
#Top   #8  
Old 10-03-2011, 12:25 PM
leofonic leofonic is offline
Senior Member
Join Date: Oct 2009
Posts: 2,188
leofonic is on a distinguished road
Default AW: Overriding oxUtilsPic::resizeImage()

No i don't think the order makes any difference. Oxutilspic is a singleton, it is created only once with the first call to oxutilspic::getInstance, "oxnew" is used there, so if your module is present in config-array "aModules" at this time it should work. If you want to figure this out some day, you could debug oxutilsobject and see what is happening there.
__________________
Frank

www.zunderweb.de - Zunderweb IT Beratung
Ajax Multifilter XL - Turbo für den Attributfilter
Reply With Quote
Reply

Bookmarks

Tags
overriding, oxutilspicresizeimage

« Previous Thread | Next Thread »
Thread Tools
Display Modes

Nicht Sichtbar
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Design Patterns - function overriding in moduls barthama Developers 2 04-26-2011 12:59 PM

All times are GMT +2. The time now is 10:57 PM.