26

Re: Image

The white screen has been fix with the latest commit.

tikky,

the plugin wasn't working properly because you couldn't change the initial settings (folder path) which by default is '/public/images'.

If you try any of your test with the following:

http://macierze-netapp.pl/wolfimage?src=/../test/rack.jpg

should confirm it. The plugin was looking for the image file in the '/public/images/test' folder.

But since this has been fixed, it doesn't really matter anymore, xD.

Last edited by andrewmman (2011-08-30 17:07)

Thumbs up +1

27

Re: Image

Andrew: I have downloaded updated version and have used your proper link.
Now everything works.

Big thanx for You, David and other participants.

--
Piotr

28

Re: Image

Just push some updates on the "dev" branch, need more testing...

29

Re: Image

devi,
not sure if you mind discussing it here, but shorter urls and hidding real path for images could be implemented in the form of Dispatcher routes, where:

'/wolfimage/:any/image/:any' => 'plugin/image/wolfimage/$1/$2'

the first parameter would represent an $alias for a folder or path set with the plugin (custom model) and the last just the image name.

I believe you (we) could include another reg in the route to pass a preset name (chain of image actions) or the actions as is (i.e: 200x100c.r45), although I'm not sure if this would be the best for future implementation of caching.

Thumbs up

30

Re: Image

I'm still playing around with woflcms dispatcher to get "something". And I'm sure you do the same, if you got "anything", please post it here or github.

31

Re: Image

I'm curious, which one is easy on the eye ? and why ?

wolfimage/resize/300/150/50/path/to/your/image.jpg

wolfimage?src=/path/to/your/image.jpg&w=300&h=150&d=50

wolfimage/resize?src=path/to/your/image.300x150x50.jpg

wolfimage?resize=path/to/your/image.300x150x50.jpg

wolfimage/resize/path/to/your/image.300x150x50.jpg

32

Re: Image

IMO, everything but first, as it would be easier to implement via page-part.

My Wolf CMS related blog Project 79 | Wolf CMS Docs

33

Re: Image

I personally always like URLs that give you the illusion its static content. That hides implementation details and has some other (caching for example) benefits.

andrewmman wrote:

not sure if you mind discussing it here, but shorter urls and hidding real path for images could be implemented in the form of Dispatcher routes, where:

'/wolfimage/:any/image/:any' => 'plugin/image/wolfimage/$1/$2'

the first parameter would represent an $alias for a folder or path set with the plugin (custom model) and the last just the image name.

Just a quick remark. I've made a small change to the Dispatcher rules in the development branch of Wolf CMS. Currently, :any would "eat up" slashes (/) and anything else. I've changed this behaviour to eat up anything BUT slashes. I introduced a new element called :all to replace the old :any.

(hope that makes sense :-p)

Wolf CMS founder and lead developer
Please always check the Support forums and Wiki before asking. (My Ohloh account.)
Like Wolf CMS? Consider making a financial contribution or see our financial report first.

34

Re: Image

@mvdkleijn I can't get it to work properly, I think line 222 supposed to be the same with line 135.

Edit: If I changed those line to be the same, then I have to change:

// Setup admin routes
$admin_routes = array (
    '/'.ADMIN_DIR          => Setting::get('default_tab'),
    '/'.ADMIN_DIR.'/'      => Setting::get('default_tab'),
    '/'.ADMIN_DIR.'/:any'  => '$1',
    '/'.ADMIN_DIR.'/:any/:all'  => '$1'
);

into:

// Setup admin routes
$admin_routes = array (
    '/'.ADMIN_DIR          => Setting::get('default_tab'),
    '/'.ADMIN_DIR.'/'      => Setting::get('default_tab'),
    '/'.ADMIN_DIR.'/:all'  => '$1'
);

Should I file an issue ?

Last edited by devi (2011-10-11 17:49)

35

Re: Image

devi wrote:

Should I file an issue ?

Nope, you are correct I believe and I changed it in Github master just after I read your post.

Wolf CMS founder and lead developer
Please always check the Support forums and Wiki before asking. (My Ohloh account.)
Like Wolf CMS? Consider making a financial contribution or see our financial report first.

36

Re: Image

I can't seem to get this script to work for some reason.

Here' what I have done so far. I have a script that I found online that reads what images are in a file and displays them in a slideshow. Now I get that working but I would like to add the cropping function of this plugin to the script so that my client would not have to manually crop each image before uploading it. This is what I have...

<script type="text/javascript">
$(document).ready(function(){
    $('#myslides').cycle({
        fit: 1, pause: 2
    });
});
</script>


<?php
$directory = 'public/images/slideshow';     
try {        
    // Styling for images    
    echo "<div id=\"myslides\">";    
    foreach ( new DirectoryIterator($directory) as $item ) {            
        if ($item->isFile()) {
            $path = $directory . "/" . $item;    
            echo "<img src=\"" . $path .  "\" />";    
        }
    }    
    echo "</div>";
}    
catch(Exception $e) {
    echo 'No images found for this slideshow.<br />';    
}
?>

I was thought I could add the &W=?&h=? code snippet here:

            $path = $directory . "/" . $item;    
            echo "<img src=\"" . $path . "&w=150&h=150&d=i" . "\" />";

That does add the needed function to the image file but then it messes up the link somehow and says there is no file. This is the link it gives

http://websitelink/public/images/slideshow/amphibious_one_eyed.jpg&w=150&h=150

Could anyone help me with this one? I really want to make it easier for my client. I even thought about incorporating jCrop in it somehow if I can't get this to work.

Thumbs up

37

Re: Image

kolorguild wrote:

... That does add the needed function to the image file but then it messes up the link somehow and says there is no file. ...

Did you read the first page of this thread? You'll see Tikky had the same problem, and I'm not sure we got a solution. But it would be worth seeing if the steps suggested for him would be any help for you.

FWIW! hmm

Using Wolf CMS professionally and for profit? Please consider supporting Wolf financially. Thanks!

38

Re: Image

David wrote:
kolorguild wrote:

... That does add the needed function to the image file but then it messes up the link somehow and says there is no file. ...

Did you read the first page of this thread? You'll see Tikky had the same problem, and I'm not sure we got a solution. But it would be worth seeing if the steps suggested for him would be any help for you.

FWIW! hmm


I did read that post and haven't seen anything specified there that helps. I have specified the setting directory for the plugin. Corrected it so I don't get the white screen when clicking on the plugin settings.

Thumbs up

39

Re: Image

Not 100% sure but I think you need to add "wolfimage?src=" before /public/something and after http://yourdomain.com.

And still not sure if you need to specify /public part or is it already included in plugin. Check path in the plugins index or controller.

My Wolf CMS related blog Project 79 | Wolf CMS Docs

40

Re: Image

As jackie mentioned, first of all you need to prepend 'wolfimage?src=' to the image source.

Then depending on the value you specified for 'Images directory' (image plugin settings), you define the path.

If you left the default value '/public/images', then your image source would be:

<img src="<?php echo '/wolfimage?src=slideshow/'.$image.'&w=150&h=150&d=i'; ?>"

or if you want a full path use:

<img src="<?php echo BASE_URL.'wolfimage?src=slideshow/'.$image.'&w=150&h=150&d=i'; ?>"

Thumbs up

41

Re: Image

I've tried a couple of times but can't seem to figure out what you mean. Well I understand that I have to include wolfimage?src (like jackie mentioned) before the path, but I'm not sure how your code fits in to the code I have already?

Thumbs up

42

Re: Image

Where you have:

echo "<img src=\"" . $path . "&w=150&h=150&d=i" . "\" />";

Replace with jackie/andrewmman's code:

echo '<img src="'.BASE_URI.'wolfimage?src=slideshow/'.$item.'&w=150&h=150&d=i" />';

(slightly modified their version...)

Wolf CMS founder and lead developer
Please always check the Support forums and Wiki before asking. (My Ohloh account.)
Like Wolf CMS? Consider making a financial contribution or see our financial report first.

43

Re: Image

ohhhhh... OK now I understand. Thank you. It worked. Wasn't sure if I could modify the original code that much.  Still a noob with php as you can tell. Hahaha... Thanks guys.

I was wondering though. How difficult would it be to incorporate the jCrop plugin in to Wolf? I was looking up a few articles about doing it but haven't quite grasped what they're saying.

Thumbs up

44

Re: Image

can anyone confirm this plug-in is working with WolfCMS 7.5SP1
I cannot get it to work and this the code i use

<?php if ($article->hasContent('img')){ ?>
<img class="left" src="<?php echo URL_PUBLIC; ?>wolfimage?src=<?php echo $article->content('img');?>&w=150&h=100" alt="<?php echo $article->title(); ?>" />

<?php } 
        else {
        echo (' ');
} ?>

and this the HTML

<img class="left" alt="My first article" src="myrootpath/wolfimage?src=contentofpagepartimg&w=150&h=100">

something is not working

Thumbs up

45

Re: Image

I can confirm it works.

Here is my sample code:

<?php if ($article->hasContent('img')){?>
            <img class="naslovna" src="<?php echo URL_PUBLIC; ?>wolfimage?src=<?php echo $article->content('img');?>&c=c&w=580" alt="<?php echo $article->title(); ?>" />
            <?php } 
                else {
                    echo (' ');
            } ?>

It's cropping by width of 580px.

Generated code looks like this:

<img class="naslovna" src="http://blog.medenjak.org/wolfimage?src=privikavanje-na-vrtic.jpg&c=c&w=580" alt="Kako mogu pomoći da se moje dijete što lakše navikne na vrtić" />

Here's the link from the site.

My Wolf CMS related blog Project 79 | Wolf CMS Docs

46

Re: Image

Still not working for me,
not sure if this would make any difference but I'm using SQLite
any idea how could i debug this?
PHP 5.3
'GD Version' => string 'bundled (2.0.34 compatible)' (length=27)
  'FreeType Support' => boolean true
  'FreeType Linkage' => string 'with freetype' (length=13)
  'T1Lib Support' => boolean false
  'GIF Read Support' => boolean true
  'GIF Create Support' => boolean true
  'JPEG Support' => boolean true
  'PNG Support' => boolean true
  'WBMP Support' => boolean true
  'XPM Support' => boolean false
  'XBM Support' => boolean true
  'JIS-mapped Japanese Font Support' => boolean false

Last edited by kirk (2013-01-21 13:37)

Thumbs up

47

Re: Image

Sorry for late reply, I was away for a few days.

Did you put "path" in the Settings panel of the plugin!?

My Wolf CMS related blog Project 79 | Wolf CMS Docs

48

Re: Image

I just wondered if anyone considered the resource risk in allowing infinite images being created by URL like this!? I considered allowing a pre-defined number of sizes to support an expected number of images to ensure that there was sufficient storage and bandwidth planning, but with todays computation abuse, I have been afraid more by this than the convenience ... anybody have anything to add to reassure me?

Thumbs up