Recent Topics

1 May 27, 2009 22:09    

Hello -

I'm having a problem with images not displaying.

The source is trying to use the following:


<img src="http://www.myurl.org/blog/htsrv/getfile.php/?root=collection_5&amp;path=myfile.jpg&amp;size=fit-400x320" alt="" title="" />

But it simply shows nothing in the post or if I try and enter the address directly into the address bar.

I have my
media/ set to 777
media/blogs/ set to 777
media/users/ set to 777
media/blogs/blogname set to 777

... is this a caching issue? If so, how do I turn it off.

2 May 28, 2009 01:46

Welcome to the forums.

Can you post an actual link to your site? Also, did you change anything regarding File Manager in backoffice or in config files?

Try to comment out the following code in htsrv/getfile.php and see if it works.

// Check permission:
if( ! $public_access_to_media )
{
	if( ! isset($current_User) )
	{
		debug_die( 'No permission to get file (not logged in)!' );
	}
	$current_User->check_perm( 'files', 'view', true );
	// fp> TODO: check specific READ perm for requested fileroot
}

3 May 28, 2009 19:11

Hello - thanks for the response.

Nothing has been changed in file manager or backoffice that I'm aware of.
I've removed that code, but it still does not display.

http://www.lpzoo.org/blog/blog5.php is the current location of the site.

The wednesday, may 13 post is where the image is embedded but not working via

<img src="http://www.lpzoo.org/blog/htsrv/getfile.php/grooming_circle.jpg?root=collection_5&amp;path=grooming_circle.jpg&amp;size=fit-400x320" alt="" title="" />

Forgive the hatchet job on the styles, learning the ins and outs!

6 May 28, 2009 20:23

um... I'm pretty sure resizing doesn't work if you are not the person who uploaded the file. Or something like that. Broke a blog recently, told the person who uploaded the image and made the post "I broke your blog", she logged in and looked, and it fixed itself.

I'm curious why that image would need resizing. The one linked here anyway. "Make image be a post" should just include that image because it is tiny. "Insert image into post" doesn't try to resize. So I'm confused.

Also image resizing is a memory hog. In conf/_advanced.php find something for ini_set that says set the memory limit to 32M, uncomment the line (remove the leading //), and increase the value to 64M. That'll help image resizing for really big images, but not likely the situation in this particular "huddle" image.

7 May 29, 2009 01:22

I'm pretty sure resizing doesn't work if you are not the person who uploaded the file. Or something like that. Broke a blog recently, told the person who uploaded the image and made the post "I broke your blog", she logged in and looked, and it fixed itself.

I don't think this is the case here, removing the permissions check (see above) allows image resizing for any user or visitor. The flaw you described is probably fixed in 3.x cos I post about it a long time ago

I'm curious why that image would need resizing. The one linked here anyway. "Make image be a post" should just include that image because it is tiny. "Insert image into post" doesn't try to resize. So I'm confused.

The original image is 434x326 which is bigger than 400x300. The image is "linked" to the post, not inserted.

@bijalba
See if PHP GD extension is loaded, go to Tools > System to check the status.

8 May 29, 2009 04:24

Ah that makes sense. Sort of... I mean, 400 wide is way narrower than that skin needs, but the sizes available are extremely limiting. And for such a small image it probably shouldn't be an issue with memory limit eh?

OT: 400 by 300 is dumb. What happens with a portrait shot? Long ago, after the "custom size" core improvement sam2kb came up with, I made all my installations use "double the width" for the height ... and made sizes every 80 pixels apart. So 480 by 960 would work nicely for that particular image.

Back on topic: why I wonder would you want to link an image that will fit in the skin the old fashioned way? Doesn't answer the problem of course. Finding out if *any* images ever resize is the path to follow here. Just curious is all.

9 May 29, 2009 07:22

Hello -

Nope,

GD Library (image handling)
GD Library version
Not installed
You will not be able to automatically generate thumbnails for images. Enable the gd2 extension in your php.ini file or ask your hosting provider about it.

What I've done in the meantime is:

//if( !empty($size) && $File->is_image() )
//{	// We want a thumbnail:
	// This will do all the magic:
//	$File->thumbnail( $size );
	// fp> TODO: for more efficient caching, this should probably redirect to the static file right after creating it
//}
//else
//{	// We want the regular file:
	// Headers to display the file directly in the browser
	header('Content-type: '.$File->Filetype->mimetype );
	header('Content-Length: '.filesize( $File->get_full_path() ) );

	if( $File->Filetype->viewtype == 'download' )
	{
		header('Content-disposition: attachment; filename="'.$File->get_name().'"' );
	}

	// Display the content of the file
	readfile( $File->get_full_path() );
//}

Thanks for your help, and this seems to be working for now. Now wish me luck that my hosting provider will be all smiles when I ask him to turn on GD2!

However, is there any other way to bypass the resizing feature and thus not need GD2 installed? Once I install GD2 is there a way to change what the default "size" is... why is it 400x320?

OT: 400 by 300 is dumb. What happens with a portrait shot? Long ago, after the "custom size" core improvement sam2kb came up with, I made all my installations use "double the width" for the height ... and made sizes every 80 pixels apart. So 480 by 960 would work nicely for that particular image.

Where is this custom size core improvement?

Perhaps I should create a feature request where you can specify what the bounds of any single image is, or just turn it off completely.

Thanks again!

10 May 29, 2009 19:27

Well the resizing thing only happens when you link in image ("make post" feature from your file manager), so to bypass it means simply don't use it. Thus you would want to make sure you upload images that will fit nicely inside your skin. The resizing trick is good for "straight from the camera to the blog" (with limitations...) and always makes the image be the top of the post by the way. http://wonderwinds.com/weblog.php/2009/04/17/what-the-hell-is-this-thing is an example of an image turned into a post. The full image is much bigger is what I mean.

The size that your resizer resizes to defaults to the 400 by 300 size (I think), and can most certainly be set in your skin. In v246 if you look at /inc/files/model/_file.class.php you will find all the sizes available.

case 'fit-720x500';
case 'fit-640x480';
case 'fit-400x320';
case 'fit-320x320';
case 'fit-80x80';

I never published my core improvement "better resizing of images" because it involves too many files and directly impacts the skin, which is a file I can't touch. Holy cow technically I sort of can I just figured out right now! Anyway if you use the search feature here for text=custom image resize* and author=sam2kb you will probably find where sam2kb shared an improvement that allows you to make the resizer be pixel-perfect for your skin.

Wow I should test the improvement to the improvement I just thought of then publish it assuming it works, but I'm kinda busy making a web services business and painting a line. Plus there is a 247 I most certainly will upgrade to, and a 320 to see how few feature requests and hook requests and fixes have been implemented. Of all these, painting a line feels like the most work but is the thing I really want to get done. But I really wanted to get that improvement out there! Forcing people to edit their skin was the reason I never did, so maybe if I can I should?

11 Nov 13, 2009 21:08

A better way is to actually resize the image physically using a plugin to work with ImageMagick that would keep the aspect ratio intact. I posted asking for help in creating such a plugin. With ImageMagick, one could change the physical size of the file, and even crop or other manipulations before saving the image to the server to be used in posts. One does not need a lot of features here, image size and crop, and rotate would do for most needs and would help when we create a site for other users who not understand that image resize by html still holds that huge 4 meg file they shot with their digital camera.

12 Nov 13, 2009 21:16

I can email you a plugin(s) that does all that ... although it's aimed at users clicking "I want to edit that image" ... I'm not liable to release/support it in anything above evo 2.4.x though, so you'd be on your own

¥


Form is loading...