Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-25-2007, 10:13 AM
Junior Member
 
Join Date: Nov 2007
Posts: 2
Default External PHP scripts with Zend Framework

Hi,
I am trying to migrate my projects to Zend Framework (MVC).
To display a picture I used to do like this
echo '<img src="functions/funcRSI.php?image=/pictures/testPic.jpg&size=150">'
and FuncRSI is
PHP Code:
header('Content-type: image/jpeg');
    if ((!isset(
$_GET['image']))||(strlen($_GET['image'])==0)){
        die(
'Please specify a file name');
    }
    if ((!isset(
$_GET['size']))||(strlen($_GET['size'])==0)){
        die(
'Please specify a width');
    }
    
$imageFile $_GET['image'];
    
$newWidth $_GET['size'];          
    if (!
file_exists($imageFile))
    {
        
$imageFile '/public_html/images/nopicture.jpg';
    }
    else
    {
        
$imageFile $imageFile;
    }                       
    list(
$width$height) = getimagesize($imageFile);
    if (
$newWidth $width){
        
$newWidth $width;
    }
    
$ratio $width/$height;
    
$newHeight $newWidth $ratio;
    
$image_temp imagecreatetruecolor($newWidth$newHeight);
    
$image imagecreatefromjpeg($imageFile);
 
    
imagecopyresampled($image_temp$image0000$newWidth$newHeight$width$height);
    
imagejpeg($image_temp,"",100);
 
 
    
imagedestroy($image_temp);
    
imagedestroy($image); 
Now, I can't do it with Zend View Helper...
Any ideas ?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 11-27-2007, 12:42 PM
Member
 
Join Date: Aug 2007
Location: Sweden
Posts: 52
Send a message via MSN to Leif.Högberg
Default

Place your code in a controller and then add
"$this->_helper->viewRenderer->setNoRender();"
to stop the default view script from being rendered.

Depending on what rewrite rules you are using you could also just put the file as it is somewhere in your webroot and not have ZF interfere with it.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 10:42 PM.