ionCube Logo
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


 
Post new topic   Reply to topic    ionCube Forum Index -> ionCube Loader

about ioncube_read_file function question

Author Message
marsjn



Joined: 05 May 2006
Posts: 11

PostPosted: Fri May 05, 2006 9:35 am    Post subject: about ioncube_read_file function question Reply with quote

Hello,
about ioncube_read_file function question

I create a test page and this is php scritp code:

<?php echo ioncube_read_file(DSC03378.JPG);?>

And I use the "Encrypt non-PHP file" to encode that image file, but always reutrn an error code "1"
----
Is it any a mistake ? please to assist.
or give me some sampe script

Thank you.
Back to top
View user's profile Send private message
liaison
ionCube Support


Joined: 16 Dec 2004
Posts: 2788

PostPosted: Fri May 05, 2006 11:22 am    Post subject: Reply with quote

Check the user guide PDF for the meaning of error code 1
_________________
Community Admin
Back to top
View user's profile Send private message
marsjn



Joined: 05 May 2006
Posts: 11

PostPosted: Fri May 05, 2006 4:45 pm    Post subject: Reply with quote

It's mean "The file could no be opened".
But I have no idea why ?
---
I want to write the script that can show image file.
Can you give me simple sample script ?

Thank you.
Back to top
View user's profile Send private message
liaison
ionCube Support


Joined: 16 Dec 2004
Posts: 2788

PostPosted: Fri May 05, 2006 5:49 pm    Post subject: Reply with quote

Most likely because the image file isn't there.

Try passing an absolute path of the image file rather than just the name. Start with dirname(__FILE__) to get the directory location of the calling script, and calculating the rest of the path based on the location of the image file relative to the location of the script.
_________________
Community Admin
Back to top
View user's profile Send private message
marsjn



Joined: 05 May 2006
Posts: 11

PostPosted: Fri May 05, 2006 6:22 pm    Post subject: Reply with quote

<p><img src="<?php echo ioncube_read_file("134504_200.jpg");?>" width="100" height="100"></p>

it show "??p>"

why?

------
The script and image file are in the same directory.
Back to top
View user's profile Send private message
liaison
ionCube Support


Joined: 16 Dec 2004
Posts: 2788

PostPosted: Fri May 05, 2006 9:42 pm    Post subject: Reply with quote

That code fragment is a nonsense. The HTML image tag expects a URI for the image, not the actual image contents itself!

If you're looking to serve dynamically generated images, which is what you will be doing in this case, the technique is to create a PHP file that reads the encrypted image and returns the decrypted data as output, and you then use that PHP file as the image source. To avoid duplication, you might pass a GET parameter to the PHP script to select the actual image.

e.g.

Code:
<img src="/getimg.php?i=animage.jpg">


getimg.php will be your PHP script that uses the Loader API function to decrypt the source image file, and you may uise some other techniques to prevent directly accessing the getimg script to leach images.

Note that the mileage of this technique may be limited, as images can be easily copied from the browser cache, or even by taking a screen shot. Where you have hundreds or thousands of images though, and coupled with anti leach protection, it may be worthwhile as users will only be able to get valid images by going through the website, and not by accessing the raw image files directly (as they're encrypted).
_________________
Community Admin
Back to top
View user's profile Send private message
marsjn



Joined: 05 May 2006
Posts: 11

PostPosted: Sat May 06, 2006 3:33 am    Post subject: Reply with quote

Hello,


To refer to the page http://forum.ioncube.com/viewtopic.php?t=310 and your to conduct, it's work fine now , thank you.

But have one another question, one of that source images for test , the image size is 2.18MB, through non-PHP encoded became 56KB and could not show success.
Does the ionCube have limit file size?

Thank you.
Back to top
View user's profile Send private message
liaison
ionCube Support


Joined: 16 Dec 2004
Posts: 2788

PostPosted: Sat May 06, 2006 10:09 am    Post subject: Reply with quote

There's no filesize limit. You can only use ioncube_read_file() from an encoded file though.
_________________
Community Admin
Back to top
View user's profile Send private message
marsjn



Joined: 05 May 2006
Posts: 11

PostPosted: Sat May 06, 2006 11:22 am    Post subject: Reply with quote

It's work fine now. Maybe to concern IE cache...

Thank you.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    ionCube Forum Index -> ionCube Loader All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum