Rename function to give link to thumb URL?

Post here if you think of a feature you'd like to see in phpThumb
Post Reply
justme
Posts: 47
Joined: Thu Jan 09, 2014 8:15 am
Are you a spambot?: no

Rename function to give link to thumb URL?

Post by justme » Sun Sep 27, 2015 10:20 am

How about adding a rename function which links to the thumb location, since we have such a long link with the hash already.....

but if you add a &rename=r=thumb=t=my_new_name&f=png......

Code: Select all

<img src="/path/to/phpThumb.php?src=/images/pic.jpg&w=100&[color=#FF0000]t=my_new_name&f=png[/color]hash=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" />
you already set up your /uploads folder so you know where that thumb is?

Code: Select all

<img src="/path/to/phpThumb.php?src=my_new_name.png /> 

James Heinrich
Site Admin
Posts: 433
Joined: Tue May 27, 2008 8:36 am
Are you a spambot?: no
Location: Northern Ontario, Canada
Contact:

Re: Rename function to give link to thumb URL?

Post by James Heinrich » Sun Sep 27, 2015 10:30 am

I don't understand what you're asking. What is the new name you're talking about?

justme
Posts: 47
Joined: Thu Jan 09, 2014 8:15 am
Are you a spambot?: no

Re: Rename function to give link to thumb URL?

Post by justme » Sun Sep 27, 2015 11:52 am

its the name of the thumbnail.....

its been a year since i used phpthumb, but i think you put all the thumbnails in monthly folders or something

So by specifying a name for the thumbnail, you have a location for it.

Hope its clear....

James Heinrich
Site Admin
Posts: 433
Joined: Tue May 27, 2008 8:36 am
Are you a spambot?: no
Location: Northern Ontario, Canada
Contact:

Re: Rename function to give link to thumb URL?

Post by James Heinrich » Sun Sep 27, 2015 1:25 pm

No, not clear at all.

The only thumbnail files that are generated by phpThumb are the cache files, and those are stored according to the hash of all the parameters used to generate the thumbnail. If you want to render an image/thumbnail to a specific filename then see the object demos, such as phpThumb.demo.object.simple.php

justme
Posts: 47
Joined: Thu Jan 09, 2014 8:15 am
Are you a spambot?: no

Re: Rename function to give link to thumb URL?

Post by justme » Sun Sep 27, 2015 8:35 pm

oh you have the function for the thumbnail already, thats great !!

SO how do i use the object? is this how i call it?

Code: Select all

<img src="/path/to/phpThumb.php?src=/images/pic.jpg&w=100&hash=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" />

<img src="/path/to/phpThumb.demo.object.php width="100%" height="300px" />
EDIT: sorry to appear noobie but how does phpthumb know which thumbs go with which image?

justme
Posts: 47
Joined: Thu Jan 09, 2014 8:15 am
Are you a spambot?: no

Re: Rename function to give link to thumb URL?

Post by justme » Sun Sep 27, 2015 8:46 pm

Code: Select all

//$phpThumb->setSourceFilename($_FILES['userfile']['tmp_name']);
	// or $phpThumb->setSourceData($binary_image_data);
	// or $phpThumb->setSourceImageResource($gd_image_resource);
SO how do i pass the source parameters to the object?

James Heinrich
Site Admin
Posts: 433
Joined: Tue May 27, 2008 8:36 am
Are you a spambot?: no
Location: Northern Ontario, Canada
Contact:

Re: Rename function to give link to thumb URL?

Post by James Heinrich » Sun Sep 27, 2015 8:50 pm


justme
Posts: 47
Joined: Thu Jan 09, 2014 8:15 am
Are you a spambot?: no

Re: Rename function to give link to thumb URL?

Post by justme » Sun Sep 27, 2015 9:10 pm

Code: Select all

// set data source -- do this first, any settings must be made AFTER this call
	$phpThumb->setSourceFilename('images/loco.jpg');  // for static demo only
	//$phpThumb->setSourceFilename($_FILES['userfile']['tmp_name']);
	// or $phpThumb->setSourceData($binary_image_data);
	// or $phpThumb->setSourceImageResource($gd_image_resource);
Ok you need to help me out a bit here, it looks like the "thumbnail" is a placement thumb for the image source? something like a disk.

Here is what i understand

1. you send parameters to phpthumb to generate an image based on the parameters

Code: Select all

<img src="/path/to/phpThumb.php?src=/images/pic.jpg&w=100&hash=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" />
2. the phpThumb.demo.object.php is used to override the output of phpthumb

3. BUT what I need is another way to call that thumb, rather than from the initial link.

Code: Select all

<img src="/path/to/phpThumb.php?src=/images/pic.jpg&w=100&hash=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" />
Lets say i want to hide that link and just display the thumbnail of that image

is it possible?

Code: Select all

<img src="/path/to/phpThumb.php?thumb_src=/images/pic.jpg&w=100&hash=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" />

Ideally i would like a
data-src=source_image
src=thumbnail

Code: Select all

<img data-src="/path/to/phpThumb.php?data-src=/images/pic.jpg&w=100&hash=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" src="/path/to/phpThumb.php?src=&w=400&hash=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" />
does it make sense yet?

James Heinrich
Site Admin
Posts: 433
Joined: Tue May 27, 2008 8:36 am
Are you a spambot?: no
Location: Northern Ontario, Canada
Contact:

Re: Rename function to give link to thumb URL?

Post by James Heinrich » Sun Sep 27, 2015 9:25 pm

phpThumb object mode and phpThumb.php are not interchangeable.
If you want to use phpThumb in object mode you're on your own for the interface file with your HTML page.

Post Reply